Skip to content
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

Cancel queryInfo.notifyTimeout when marking final results. #7347

Merged
merged 3 commits into from
Nov 20, 2020

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented Nov 19, 2020

As the reproduction in #7346 demonstrates, it was possible for the QueryInfo#notify timeout set in QueryInfo#setDiff on behalf of an earlier loading: true result to fire after the final loading: false result had been recorded in QueryInfo#markResult, which could lead to unnecessary network requests when using a FetchPolicy of cache-and-network or network-only, especially when there are multiple useQuery calls in the same React component.

This PR fixes that problem by canceling the timeout in QueryInfo#markResult and markError, since those methods are called by code that delivers the results through other mechanisms.

@benjamn benjamn added this to the Post 3.0 milestone Nov 19, 2020
@benjamn benjamn self-assigned this Nov 19, 2020
benjamn added a commit that referenced this pull request Nov 19, 2020
@benjamn benjamn force-pushed the 7346-cancel-notifyTimeout-when-marking-result branch from b2f3e55 to 7e2e5b4 Compare November 19, 2020 21:21
Copy link
Member

@hwillson hwillson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @benjamn - thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants