-
-
Notifications
You must be signed in to change notification settings - Fork 461
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
(graphcache): Getting non-stale flags for partial results #2937
Comments
Sorry for the delay, I finally had some time to look into this. To give you some context, it took me a while to get the reproduction running, since after downloading it from CodeSandbox, dependencies weren't exactly working and the JSX+TS build was failing in Parcel, so I came back to this later than I originally wanted to. This looks to me like a regression in Specifically, on the following line of code, we now have a looping protection, which prevents us from reexecuting dependent operations. Basically, in your case, if we get a response from both of your queries, if both queries always remained "partial" then they'd infinitely tell each other to refetch. Of course this isn't the case, but the rule that prevents this still is being applied here:
However, #2831 made a change that doesn't take into account that So, the fix is rather simple, and we'll have to set this flag regardless of whether a loop has been interrupted |
Thank you 💚 |
Describe the bug
I'm using
urql
,@urql/core
,@urql/exchange-graphcache
and@urql/exchange-execute
and I think I'm getting at least a stale state wrong. There is a small reproduction of the issue available that shows the setup, but in short:When loading two queries (covering in part the same sections) in parallel and a partial result can be available for the slower of them the both the loading and the stale state of the slower query is set to false. This is the output I get from the reproduction (altered for clarity):
This seems to be in contrast with the information available at https://formidable.com/open-source/urql/docs/graphcache/schema-awareness/#partial-results which suggest the stale flag should be set until the full data is available.
There has also been some discussions on this topic earlier in #2282 which also seems to align with the documentation.
I would perhaps also expect the fetching flag to be set until the first real non-partial data is present but I don't know if that is expected or not.
Reproduction
https://codesandbox.io/s/js-playground-forked-i715qc?file=/src/index.tsx
Urql version
@urql/core v3.1.1
@urql/exchange-execute v2.1.1
@urql/exchange-graphcache v5.0.8
urql v3.0.3
graphql v16.6.0
Validations
The text was updated successfully, but these errors were encountered: