Skip to content
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

Add isLoading state and refactor the core #1928

Merged
merged 1 commit into from Apr 16, 2022
Merged

Add isLoading state and refactor the core #1928

merged 1 commit into from Apr 16, 2022

Conversation

shuding
Copy link
Member

@shuding shuding commented Apr 16, 2022

This PR removes the isFallback state added in #1925, with a new isLoading state which covers more common use cases. Basically it's considered as "loading" when there is no loaded data* for the current key yet, while we are loading new data.

*loaded data = data returned by the fetcher, not fallback or laggy data.

Here is a diagram showing the difference between isLoading and isValidating:

Page 1

@shuding shuding requested a review from huozhi as a code owner April 16, 2022 15:45
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit c3eca50:

Sandbox Source
SWR-Basic Configuration
SWR-States Configuration
SWR-Infinite Configuration
SWR-SSR Configuration

@shuding shuding merged commit 0f552d8 into main Apr 16, 2022
@shuding shuding deleted the shu/fe0a branch April 16, 2022 15:49
himanshiLt pushed a commit to himanshiLt/swr that referenced this pull request Apr 26, 2022
@koba04 koba04 mentioned this pull request Aug 5, 2022
13 tasks
@koba04
Copy link
Collaborator

koba04 commented Aug 6, 2022

This diagram is amazing! We should add this in the v2 docs! 😍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants