Skip to content

isLoading, isValidating always returns true when fallbackData is set #2369

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

Closed
MateuszPaulski opened this issue Jan 19, 2023 · 0 comments · Fixed by #2382
Closed

isLoading, isValidating always returns true when fallbackData is set #2369

MateuszPaulski opened this issue Jan 19, 2023 · 0 comments · Fixed by #2382
Labels
bug Something isn't working

Comments

@MateuszPaulski
Copy link

Bug report

Description / Observed Behavior

isLoading / isValidating values are incorrect when fallback or fallback data is set and can cause infinite loading issue after disabling revalidation options.

Expected Behavior

IsLoading and isValidation should be only set to true when there is ongoing request:

isValidating becomes true whenever there is an ongoing request whether the data is loaded or not
isLoading becomes true when there is an ongoing request and data is not loaded yet.

in the case below we dont have ongoing requests and we have data loaded (from fallback) so isLoading and isValidating values should be false.

Repro Steps / Code Example

https://codesandbox.io/s/cranky-wright-xg4kpv?file=/src/App.js

Additional Context

SWR version.
2.0.1

@promer94 promer94 added the bug Something isn't working label Jan 20, 2023
promer94 added a commit to promer94/swr that referenced this issue Jan 26, 2023
shuding pushed a commit that referenced this issue Jan 27, 2023
…ed (#2382)

* fix: initial loading state should be false with revalidation is disabled with fallbackData

close #2369

* chore: dont read external data in useMemo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants