How to perform optimistic updates on Infinite Query #1902
-
I have an infinite query that fetches all comments. All the comments are available in pages. I use I want to perform a comment insert, I want to optimistically update the comments list by appending the comment to the end. How can I achieve this? I have tried a lot of different ways, so any pointers would be really helpful. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It should work the same as optimistic updates on a normal query, except that you have to keep the structure in mind. The cached data is an object with two keys (pages and pageParams), so you’d likely want to create a new page with the new entry. |
Beta Was this translation helpful? Give feedback.
It should work the same as optimistic updates on a normal query, except that you have to keep the structure in mind. The cached data is an object with two keys (pages and pageParams), so you’d likely want to create a new page with the new entry.