Closed frederikhors closed 1 year ago
Sorry. I think it was the requestPolicyExchange
which I don't need.
I think this deserves your checking, @kitten. Because it is strange what is happening.
Even though I'm using requestPolicyExchange
I think it doesn't have to reload queries I'm not calling:
requestPolicyExchange({
ttl: 1,
shouldUpgrade: (e) => {
console.log("test, e:", e);
return true;
}
}),
This is expected behaviour.
You've set the requestPolicyExchange
to ttl: 1
, which practically means that every operation will be upgraded to cache-and-network
. This in turn means that when the todo list is refreshed after the mutation, its operation is upgraded to cache-and-network
You can even see in the network tab that it's the list query after:
If you increase the TTL, the new request will not be made until the TTL is expired
I thought the requestPolicyExchange
was only for queries that the user triggers, not for queries that have already finished. In this case the list query is already finished and so I thought it would hang until I call it (and in that case it checks the TTL).
Okay. Now I understand that this exchange operates differently.
Describe the bug
@kitten, as usual I cheered too soon before discovering ONE DIFFERENT PROBLEM probably brother of the other.
Steps:
Start the backend visiting: https://codesandbox.io/p/sandbox/h1pcl
Open the frontend reproduction: https://stackblitz.com/edit/sveltejs-kit-template-default-y5hteh
Go to "List"
Wait for the list to appear
Open browser Dev tools on the "Network" panel
Click on the button "Complete" on one todo
The first call starts and after some seconds it finishes
AND NOW THE NEW PROBLEM (with
"6.1.5-canary-7ddccc13"
at least):Another call starts! For every action, even if you click on the "Add more random todos" button.
I'm sad again! :LOL:
Urql version
Gif
Validations