Allow stopPolling
to abort in flight queries.
#347
Labels
core
Feature requests related to core functionality
stopPolling
to abort in flight queries.
#347
Why
I'm running in an issue involving polling with cache writes. Let's say I have a network request on Q which returns a collection of type A. This type A is joined with a collection of type B.
A is being polled every 5 seconds. I have a mutation M which creates new instances of B. In the context of a React app, I use the
update
function of parameters for mutation M to write to the cache of query Q withcache.updateQuery
, and append created items of type B to instances of type A.Because I don't want polling to occur while mutation M is ongoing, I
stopPolling
right before initiating M. However, sincestopPolling
doesn't abort in flight queries, it will sometimes happen that Q cache writes are overridden by a query Q initiated before polling was stopped, causing UI inconsistencies.Proposed solution
abortInFlightQueries
flag tostopPolling
function;abortInFlightQueriesWhenPollingStops
inuseXQuery
hook.Related Feature Requests
The text was updated successfully, but these errors were encountered: