-
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
Support conditional fetching in useSWRInfinite #936
Comments
@em maybe you can try but another case is when fetch request error, useSWRInfinite will also return infinite loop |
Thanks wildfrontend. I was able to workaround before I filed the issue by just restructuring things with wrapper components. Conditional fetching in useSWR is really just sugar anyway and the same thing can be accomplished by conditional rendering, it can just make your component IA not very nice. I filed the issue because it's a nice-to-have feature request for useSWRInfinite to have parity with useSWR. As an aside - there are a lot of caveats with useSWRInfinite, some are addressed in the original PR, but not documented in the official docs. Would be really nice for those to be big disclaimers at the top. |
FYI you can pass |
Hi I have same problem , if chat id undefined on first render , useSWRInfinite send requests on second render receive data from API , but const {data }=undefined even if i see data in network tab google chrome
|
I've tried passing null instead of a getKey function to useSWRInfinite. Also tried returning null from getKey.
In both cases, this results in a deadlock where no additional pages will be loaded when setSize is used to increase the size.
The text was updated successfully, but these errors were encountered: