Closed jovanhartono closed 1 month ago
I don't see why it wouldn't work - what problem are you encountering?
I don't see why it wouldn't work - what problem are you encountering?
the cached value not merged with the new data
i have this query
when show more button is clicked, it will append the searchParams after=endCursor, the page Component will then get the searchParams and pass it into the variables. i have tried this but the previous values are cleared. any idea why?
the cached value not merged with the new data
Yes, that's to be expected. You are in React Server Components.
React Server Components only exist for a single render conceptually - there is no "persistence", they are 100% stateless.
You can have a RSC render page 8 and then go to page 9 and render that in isolation, but you can never render page 9 and have page 8 "merged into it" because it doesn't have any knowledge that you were on page 8 before.
=> You can do "pagination" as in "show a single page at a time", but not "infinite scrolling".
the cached value not merged with the new data
Yes, that's to be expected. You are in React Server Components.
React Server Components only exist for a single render conceptually - there is no "persistence", they are 100% stateless.
You can have a RSC render page 8 and then go to page 9 and render that in isolation, but you can never render page 9 and have page 8 "merged into it" because it doesn't have any knowledge that you were on page 8 before.
=> You can do "pagination" as in "show a single page at a time", but not "infinite scrolling".
thank you for your time. your responses helped me a lot. closing this issue
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.
or it must be using useSuspenseQuery()?
the idea is to pass the endCursor to the URL state -> get the cursor params -> passing it into the
getClient().query({query: someQuery, variables: {after: cursor}})