Comments (13)
@jingledongding an update on this. I managed to reproduce a pagination issue on a different query. Not sure if this is related but seems to manifest itself in a very similar way to your issue. I'll keep you in the loop when we know more from the Lens API team.
from lens-sdk.
I think this issue is related to #382 and there is a fix in v.1.1.1 that was released today, @jingledongding could you try if the v1.1.1 works for you?
npm install @lens-protocol/[email protected]
from lens-sdk.
Hi @jingledongding , thank you for reporting this.
We recently promoted 1.1.0
to stable.. can you please try to upgrade and see if the problem persist?
From your description I am inclined to think of an API issue, but I wasn't able to reproduce anything from my testing.
In 1.1.0 we also introduced a prev
callback which helps with retrieving newer results. Wondering if this could be of any help for your usage.
from lens-sdk.
When I switch the sortCriteria filter to PublicationSortCriteria.TopCollected, everything works fine.
from lens-sdk.
Thank you for your assistance. I will try it out soon.
from lens-sdk.
@cesarenaldi Hi,I have upgraded to version 1.1.0 and conducted a series of tests. It seems that the issue lies with the data returned on the first request, as it appears to be unexpected and prevents me from obtaining the next page of data. When I skip the hasMore check and directly make the next request, I am able to retrieve the data. However, this also prevents me from merging it with the cache. Additionally, if I make another next page request, it resets back to the initial pointer.
code:
const { data: publications, loading, hasMore, next, } = useExplorePublications({ limit: 20, sortCriteria: PublicationSortCriteria.Latest, publicationTypes: [PublicationTypes.Post], })
first query:
{ "operationName": "ExplorePublications", "variables": { "limit": 10, "publicationTypes": [ "POST" ], "sortCriteria": "LATEST", "observerId": null, "sources": [], } "query":{...}, }
response data:
{ "data": { "result":{ "item":[...], "pageInfo": { "__typename": "PaginatedResultInfo", "prev": "{\"timestamp\":1,\"offset\":0}", "next": "{\"timestamp\":1,\"offset\":10}", "totalCount": null }, "__typename": "ExplorePublicationResult", } } }
The following is an example of data that allows for a successful request for the next page.
code:
const { data: latestCreateds, hasMore: latestHasMore, next: latestNext, } = useExploreProfiles({ sortCriteria: ProfileSortCriteria.LatestCreated, limit: 20, observerId: activeProfile?.id, })
query:
{ "operationName": "ExploreProfiles", "variables": { "limit": 20, "observerId": null, "sortCriteria": "LATEST_CREATED", "sources": [] }, "query":{...}, }
response data:
{ "data": { "result":{ "item":[...], "pageInfo": { "__typename": "PaginatedResultInfo", "prev": "{\"offset\":0}", "next": "{\"offset\":20}", "totalCount": 117761 }, "__typename": "ExploreProfileResult" } } }
I'm not familiar with the repository and don't know what's happening internally. Can you help me take a look, please?
from lens-sdk.
Thank you @jingledongding for these details. We'll investigate further.
from lens-sdk.
Thank you for your kind words. Keep up the great work!
from lens-sdk.
@cesarenaldi Hi,I have upgraded to version 1.1.0 and conducted a series of tests. It seems that the issue lies with the data returned on the first request, as it appears to be unexpected and prevents me from obtaining the next page of data. When I skip the hasMore check and directly make the next request, I am able to retrieve the data. However, this also prevents me from merging it with the cache. Additionally, if I make another next page request, it resets back to the initial pointer.
code:
const { data: publications, loading, hasMore, next, } = useExplorePublications({ limit: 20, sortCriteria: PublicationSortCriteria.Latest, publicationTypes: [PublicationTypes.Post], })
first query:{ "operationName": "ExplorePublications", "variables": { "limit": 10, "publicationTypes": [ "POST" ], "sortCriteria": "LATEST", "observerId": null, "sources": [], } "query":{...}, }
response data:{ "data": { "result":{ "item":[...], "pageInfo": { "__typename": "PaginatedResultInfo", "prev": "{\"timestamp\":1,\"offset\":0}", "next": "{\"timestamp\":1,\"offset\":10}", "totalCount": null }, "__typename": "ExplorePublicationResult", } } }
The following is an example of data that allows for a successful request for the next page. code:
const { data: latestCreateds, hasMore: latestHasMore, next: latestNext, } = useExploreProfiles({ sortCriteria: ProfileSortCriteria.LatestCreated, limit: 20, observerId: activeProfile?.id, })
query:{ "operationName": "ExploreProfiles", "variables": { "limit": 20, "observerId": null, "sortCriteria": "LATEST_CREATED", "sources": [] }, "query":{...}, }
response data:{ "data": { "result":{ "item":[...], "pageInfo": { "__typename": "PaginatedResultInfo", "prev": "{\"offset\":0}", "next": "{\"offset\":20}", "totalCount": 117761 }, "__typename": "ExploreProfileResult" } } }
I'm not familiar with the repository and don't know what's happening internally. Can you help me take a look, please?
@jingledongding I was looking at your examples again and there's 2 question I have.
The first one is:
are you sure the query for the first call belongs to the use of useExploreProfiles
few lines above? I see the limit
in the useExploreProfiles
call is set to 20 but the query has 10.
Also is it possible in your tests you are calling next
"too early", before the initial request loading
transitioned from true
to false
?
from lens-sdk.
Potentially related but we're also experiencing issues with usePublications
hook where hasMore
is always false
even though the first query has pageInfo.next
defined.
const LensFeed = ({ profileId }: { profileId: ProfileId }) => {
const {
data: publications,
hasMore,
next,
loading,
} = usePublications({
profileId,
limit: 10,
});
return (
<div className={styles.feed}>
{publications?.map((post) => (
<LensPost publicationID={post.id} key={post.id} />
))}
{hasMore && (
<Button onClick={next} buttonType="modeOnBackground" loading={loading}>
See More
</Button>
)}
</div>
);
};
from lens-sdk.
I apologize for the mistake in the example code. To clarify, the correct value for "limit" should be 10
from lens-sdk.
awesome, it is very useful for me
from lens-sdk.
then I'm closing this issue, thanks all for your participation!
from lens-sdk.
Related Issues (20)
- Unable to retrieve the latest publication. @lens-protocol/react":1.3.1 HOT 3
- My React Native project encountered significant issues when upgrading to V2 HOT 4
- Add WalletAuthetificationToProfileAuthetification to sdk HOT 3
- Here is the diff that solved my problem: HOT 2
- The 'useOwnedHandles' hook failed to execute correctly in the production environment
- It seems that the data provided by useOwnedHandles is not sufficiently real-time. I am unable to retrieve the profile I purchased through this hook. HOT 2
- Support Node Engine 20 HOT 3
- When I switch to a new wallet, LensProvider doesn't replace with the new signer. Can anyone help me look at this issue HOT 3
- useSetProfileMetadata should update the profile cache returned by useSession HOT 2
- Support wagmi v2 HOT 5
- In the useOpenAction react hook, when the user doesn't have enough funds to collect, an unhandled promise is being thrown instead of being handled by the SDK HOT 7
- Add support for React suspense HOT 9
- Regression in latest version of the SDK 2.0.0-alpha.29 when creating a publication HOT 9
- Get a refreshed access token if expired HOT 29
- SSR support with the React SDK HOT 2
- export 'isObject' (imported as 'isObject') was not found in '@lens-protocol/shared-kernel' HOT 3
- Apollo cache issue when liking or bookmarking your own posts HOT 5
- @lens-protocol/react-web HOT 4
- usePublications failed to execute if one of publication on scope have an invalid encryption condition HOT 1
- verifyFrameSignature: SIGNER_ADDRESS_CANNOT_USE_PROFILE(Lens Frame) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lens-sdk.