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 isFallback state #1925

Merged
merged 3 commits into from Apr 15, 2022
Merged

Add isFallback state #1925

merged 3 commits into from Apr 15, 2022

Conversation

shuding
Copy link
Member

@shuding shuding commented Apr 15, 2022

After putting some time into #1922, I got the conclusion that:

  • The fallback logic should be inside the useSWR hook, and middleware should receive the same final value as the end user.
  • To correctly implement some logic, not limiting to laggy, both middleware and the user should be able to tell if the fallback is returned.

And in 2.0, fallback will be an important feature for SWR as it covers all the SSR cases (Suspense in SSR too). It's critical to make it more complete.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 15, 2022

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 d710ddd:

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

@shuding shuding marked this pull request as ready for review April 15, 2022 19:30
@shuding shuding requested a review from huozhi as a code owner April 15, 2022 19:30
@shuding shuding merged commit 2af00e9 into main Apr 15, 2022
@shuding shuding deleted the shu/78ee branch April 15, 2022 19:34
himanshiLt pushed a commit to himanshiLt/swr that referenced this pull request Apr 26, 2022
* add isFallback

* remove -m

* add test case
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

1 participant