Skip to content

How to set fallback with useSWRInfinite? #1895

Answered by luigi-derson
ramirezsandin asked this question in Q&A
Discussion options

You must be logged in to vote

I'm also having the same issue.

unstable_serialize should be imported from swr/infinite I think, which means it accepts a getKey function as parameter:

[unstable_serialize((size, prevData) => ['your', 'key', size ] )]: data or [data] ? Docs are not clear for swr/infinite case

But this is not working for me neither

UPDATE:
@ramirezsandin FYI

I did work now, my issue was that I was overriding the SWR config.

This is what it worked for me:

[unstable_serialize((size) => ['your', 'key', size ] )]: [data]

And in my useSWRInfinite file:

const swr = useSWRInfinite((key) => ['your', 'key', size ], fetcher, config)

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@ramirezsandin
Comment options

Answer selected by ramirezsandin
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
Category
Q&A
Labels
None yet
3 participants