You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to merge the revalidated data and previous fetched data in useSWR / useSWRInfinite?
My use case is fetching data from an API with pagination and the data refreshes very quickly. I want to include the most recent data that did not exist in my previous fetch and now add it to my data. eg:
Previous
Revalidated
What I want
4, 5, 6
1, 2, 3
1, 2, 3, 4, 5, 6
I am thinking that if I could somehow have access to both data during revalidation and then I can merge them. Any help would be appreciated! Thank you.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to merge the revalidated data and previous fetched data in useSWR / useSWRInfinite?
My use case is fetching data from an API with pagination and the data refreshes very quickly. I want to include the most recent data that did not exist in my previous fetch and now add it to my data. eg:
I am thinking that if I could somehow have access to both data during revalidation and then I can merge them. Any help would be appreciated! Thank you.
Beta Was this translation helpful? Give feedback.
All reactions