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

fix(react): Fix execute functions' state change being discarded after pause change #3323

Merged
merged 3 commits into from
Jul 21, 2023

Conversation

kitten
Copy link
Member

@kitten kitten commented Jul 21, 2023

Resolves #3289
Supersedes #3289

Summary

This updates the outdated dependencies array in react-urql’s useQuery (which still contained getSnapshot) and adds args.pause. It does the same in useSubscription.

When executeQuery/executeSubscription are not re-created when all dependencies change, the first render when they're outdated would refresh the dependencies to an older version, causing the source to be immediately overridden again.

This specifically caused an edge case because the dependencies didn't include args.pause. This means that the execute functions are outdated the render after args.pause changes, and means that their state change is immediately overwritten.

Set of changes

  • Update executeQuery / executeSubscription dependencies to account for args.pause changes

@kitten kitten changed the title Fix/react usequery pause edgecase fix(react): Fix execute functions' state change being discarded after pause change Jul 21, 2023
@kitten kitten merged commit 2acc629 into main Jul 21, 2023
6 checks passed
@kitten kitten deleted the fix/react-usequery-pause-edgecase branch July 21, 2023 13:08
@github-actions github-actions bot mentioned this pull request Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant