why context canceled? #3465
-
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 12 replies
-
Could you make a reproduction or at least give us something to work off, your details are a bit low 😅 it could be that you are using |
Beta Was this translation helpful? Give feedback.
-
We'd need more information here. However, I went ahead and created two sandboxes to quickly validate this:
Those are derived from our examples, which are made for reproductions, basically. To summarise the problem here, there's some gotchas when changing the request policy for every operation to urql/packages/core/src/client.ts Lines 153 to 156 in 73628b7 This is not a problem though! It should still work 😅 |
Beta Was this translation helpful? Give feedback.
-
I'm still adjusting the code and doing some research,
but When I did urql with CSR only, without SSR, the problem did not cause the context cancel issue. |
Beta Was this translation helpful? Give feedback.
-
I have tried to minimize the code here to make sure it works, but on rare occasions I get an error when I make a screen transition. https://github.com/gonta1026/urql-sample |
Beta Was this translation helpful? Give feedback.
Urql side
I have looked at your reproduction and honestly, I don't know why the first request goes through, this check is due to the
cache-check
which tries to see synchronously whether or not there is a cached item available.What this seems to signal is that the
effect
cleanup phase of React seems to be delayed longer than a microtick. When I change this to wait a tick i.e.setTimeout(x, 0)
then it correctly cancels the request.There are a few solutions I see here from the urql side of things
cache-only
policyThe issue here being that we don't know whether this react change will be long-t…