You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changes to context can cause new network requests when updated between renders. This is due to the fact that we do a deep equality check on options and if they change, execute a reobserve. In many cases, this works ok as the applied options should just cause the client to read from the cache again, but when used with a fetchPolicy like no-cache, this can cause new refetches. This is especially problematic if you want to use AbortController to handle cancelling previous fetches.
We should also consider expanding this to other options as well. For example, a change to errorPolicy should not cause a refetch but rather should be applied to the next fetch. Suspense hooks already have this behavior built-in.
We should also consider adding the ability to revert the behavior back to its current form where changes to context would cause refetches in case there are users that currently rely on this.
Issue Description
Changes to
context
can cause new network requests when updated between renders. This is due to the fact that we do a deep equality check on options and if they change, execute areobserve
. In many cases, this works ok as the applied options should just cause the client to read from the cache again, but when used with afetchPolicy
likeno-cache
, this can cause new refetches. This is especially problematic if you want to useAbortController
to handle cancelling previous fetches.We should also consider expanding this to other options as well. For example, a change to
errorPolicy
should not cause a refetch but rather should be applied to the next fetch. Suspense hooks already have this behavior built-in.We should also consider adding the ability to revert the behavior back to its current form where changes to
context
would cause refetches in case there are users that currently rely on this.Link to Reproduction
https://discord.com/channels/1022972389463687228/1235943877765238847/1235943877765238847
Reproduction Steps
No response
@apollo/client
version3.10.2
The text was updated successfully, but these errors were encountered: