Replies: 1 comment
-
+1 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
I think SWR looks pretty useful and is exactly what I was missing so far to cache my API requests. I have one question though: We use a RESTful API with index based pagination, e.g. /api/users?page=1&pageSize=10. How should we handle the following case: A user which was listed on page 0 gets deleted. All cached paginated requests will now be outdated by this change, because all users get shifted by one position due to the deletion. I imagine this would result in an ugly optical UX glitch: every time the current page is changed, the stale data shows the old ordering until revalidation has finished. Can I somehow invalidate many swr-keys with a wildcard or something? I do not want to manually "fix" the data locally on the client-side because in the frontend I may not know at which position the user was. Am I missing something here? Thanks for your help.
Beta Was this translation helpful? Give feedback.
All reactions