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

Concurrent requests (suspense) with same response data will remain pending and causes an infinite request loop #1056

Closed
stefanbugge opened this issue Mar 20, 2021 · 1 comment

Comments

@stefanbugge
Copy link

stefanbugge commented Mar 20, 2021

Bug report

Description / Observed Behavior

Thank you for a great library!

I am rendering a list of components each using swr internally in suspense mode. Each component fetches data with different urls and the response data may result in structurally equal response data (which seems to be the key issue when fetching concurrently).
The initial load will be successful for all requests, but triggering a subsequent request for all components will cause requests resulting in same response data to remain pending and have the caller components remain in a suspended state. Furthermore, an infinite request loop has begun in the background calling the fetcher function every ~2 seconds.

This seems to only be an issue with version 0.5.x. Version 0.4.2 does not exhibit this behavior.

Expected Behavior

To resolve data successfully

Repro Steps / Code Example

https://codesandbox.io/s/swr5-concurrent-suspense-bug-onut5?file=/src/App.tsx

Additional Context

SWR version 0.5.x

@promer94
Copy link
Collaborator

Thanks for your detailed repro. It's really helpful !
I think it is related to #907

promer94 added a commit to promer94/swr that referenced this issue Mar 21, 2021
promer94 added a commit to promer94/swr that referenced this issue Mar 21, 2021
promer94 added a commit to promer94/swr that referenced this issue Mar 28, 2021
shuding pushed a commit that referenced this issue May 3, 2021
* fix #1056

* add test for #1056
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

No branches or pull requests

2 participants