-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
infinite (beta): data becomes empty when using setSize and initialData #1362
Comments
This is expected behavior. SWR infinite revalidates the first page when setting size, to ensure the entire list is fresh.
Possibly caused by #1343. |
@hazae41 Could you provide more details about your fetcher and how's the initialData look like? Will be nice to have a minial repro in codesanbox |
My My |
I did some tests and found the issue happens since 1.0.0-beta.11, everything is ok on 1.0.0-beta.10 |
@hazae41 Could you help create a codesandbox or share a repo link? 🙏 |
I opened #1379 to fix this. |
I did some tests and found the bug happens when:
https://codesandbox.io/s/crimson-darkness-gyjtc?file=/pages/index.tsx |
Bug report
Description / Observed Behavior
useSWRInfinite behaves weirdly when there is some initialData and when I use setSize()
Expected Behavior
It should not
Repro Steps / Code Example
Here is my code:
(props.pages is given by Next.js SSR and never changes between renders)
I get the following logs:
... then after I click "load more"
As you can see, data becomes an empty array for a short moment
This is a problem because the UI doesn't show anything within that moment
Additional Context
I use [email protected]
The text was updated successfully, but these errors were encountered: