-
|
I have a I understand how I can manipulate the cache in Additionally, when my mutations returns a Previous discussions that I could find here dealt mostly with simple pagination lists rather than Relay spec based pagination. Any help is appreciated :D EDIT to add keywords for future searchers: The same questions above could be applied to results for a subscription that needs to update a list using Relay pagination. I suspect the solution to both problems is (nearly) the same. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
I believe it may be better not to update the cursor or
So on this point and the last, cursors are basically state that is passed back to the server. Because optimistic data never passes back to the server it won't need to update. The only thing you have to be concerned about is when it's possible to pass invalid cursors to the server. So the right thing is not to alter the cursor just because you don't want to queue up another query with an optimistically (read: client-side) created cursor. This is also not an issue because even if your cursor is off by one or two added items, those items will still be returned by the query either way when that next page is fetched. So the thing here to remember is:
|
Beta Was this translation helpful? Give feedback.
I believe it may be better not to update the cursor or
pageInfoat all. What has previously worked for others and in Relay for instance, afaik, is to append only the edge or item to the last page (or any appropriate one). All queries regarding the optimistic update will be blocked anyway while the mutation is ongoing, so there's no risk of "losing" the added optimistic item, and there's also no point of optimistically updating the cursor. In fact, sinceoptimisticin the best case scenario only returns data and doesn't use cache updates directly andupdatesadds the new item to a list (regardless of whether it's optimistic or not) this s…