Skip to content

Pagination with useSWR: How to mutate/trigger a revalidation with dynamic keys? #488

Answered by sergiodxa
jordymeow asked this question in General
Discussion options

You must be logged in to vote

You can call mutate passing the exact same key, if you want to revalidate them all you can use cache.keys to search the key you want based on a regex and then revalidate them.

I have a tiny lib for this use case called swr-mutate-many (https://github.com/sergiodxa/swr-mutate-many).

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
6 replies
@sergiodxa
Comment options

@skotchpine
Comment options

@frankalbenesius
Comment options

@bobbyshaw
Comment options

@scottopolis
Comment options

Answer selected by jordymeow
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
7 participants