-
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
[Experimental] Support promises as fallback data #2891
Conversation
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should avoid upgrading react to a specific version here?
we currently have a spearte testing workflow for react@canary at https://github.com/vercel/swr/actions/workflows/test-canary.yml
so i guess we could create a sperate jest config for this and only test it in react canary ?
This PR introduces the ability to accept promises as fallback data for SWR read hooks. The behavior is that the resolved value of the promise will be used as fallback instead of the promise itself.
The resolution of the promise is implemented via
use
which means that it will suspend the upper boundary.