-
-
Notifications
You must be signed in to change notification settings - Fork 462
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
Suspense: 'network-only' fetches twice #1243
Comments
Just leaving a note here for debugging, as discussed, with network-only this is likely expected behaviour and not avoidable, but this behaviour also happens with cache-and-network |
@kitten so I think I mentioned this, but if |
My concern is more with In other words, detecting Suspense and predicting what to do after won't do us any good when we can't tell what component we're returning to. Concurrent makes this situation even harder since we can't tell if and when a component is active again; for all intents and purposes it'll be a "new instance". Lastly having state around still or not won't either do us any good if we need the query stream to become active (while it can't stay active during an interrupt) when the component "resumes" |
Hey folks!
Opening an issue after a long chat with @kitten. When suspense is enabled, and you set a hook or component to
network-only
, the request fires twice.Phil said this is expected behavior given the current implementation (which makes sense, the component is rendered twice, once before suspending and then again after the initial request resolves). That being said; I think this will still surprise folks when they migrate to suspense in the future, and should be considered a bug I think.
urql version & exchanges:
Steps to reproduce
https://codesandbox.io/s/gifted-bohr-honuf?file=/src/App.tsx
Expected behavior
The request only fires once
Actual behavior
The request fires twice
Is there anything else I can provide or explain? Here to help 🙏
The text was updated successfully, but these errors were encountered: