Why does useSWRInfinite make 2 calls to the backend for every request? #1612
Unanswered
grantspilsbury
asked this question in
Q&A
Replies: 5 comments 1 reply
-
I have the same issue |
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
0 replies
-
raised the issue: |
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
0 replies
-
The behavior is explained in #1401, there is also a new option |
Beta Was this translation helpful? Give feedback.
1 reply
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.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a load more button, within a brand new nextjs app, that uses useSWRInfinite. Every time I click it it makes 2 calls to my backend. The first call is with index 0 and the second is with the incremented index.
Here is my component:
And here is my endpoint
These are the logs after I've clicked the button 3 times:
Why does it call the backend with page / index 0 and then again with the correct incremented index?
Beta Was this translation helpful? Give feedback.
All reactions