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

Fix suspense hanging #49

Merged
merged 2 commits into from
Oct 30, 2019
Merged

Fix suspense hanging #49

merged 2 commits into from
Oct 30, 2019

Conversation

shuding
Copy link
Member

@shuding shuding commented Oct 30, 2019

The problem is caused by useHydration.

When enabling SSR with frameworks like Next.js, we have to match the SSRed result with the client rendered result on hydration, so we skipped from reading the cache.
But when suspense is enabled, we need to read from cache before the component is mounted.

Close #46 #39

@shuding shuding requested a review from Timer as a code owner October 30, 2019 19:57
src/use-swr.ts Show resolved Hide resolved
@shuding shuding merged commit 0a3ce2a into master Oct 30, 2019
@shuding shuding deleted the fix-suspense-hanging branch October 30, 2019 23:26
@RobertBorg
Copy link

I think you intended for this fix to be part of 0.1.2 release but it's not afaik.

@shuding
Copy link
Member Author

shuding commented Oct 31, 2019

@RobertBorg ah! Thank you for noticing, will publish a new release.

@shuding
Copy link
Member Author

shuding commented Oct 31, 2019

Published swr@0.1.5 🎉

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.

Suspense is not resolved and the requests are looping
3 participants