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(graphcache): mutation would cause dependent operations and reexecuting operations become the same set #3665

Merged
merged 3 commits into from
Sep 9, 2024

Conversation

xuanduc987
Copy link
Contributor

Summary

The PR #2761 moved reexecutingOperations = dependentOperations assignment into if (operation.kind === 'query') guard. Thus after a completion of mutation, dependentOperations = _reexecutingOperations make reexecuting and dependent operations the same set object.

I noticed this issue after debugging the bug reported in discord https://discord.com/channels/1082378892523864074/1082386845553406002/1281542643670712334

…uting operations become the same set

The PR urql-graphql#2761 moved `reexecutingOperations = dependentOperations` assignment
into `if (operation.kind === 'query')` guard. Thus after a completion of
mutation, `dependentOperations = _reexecutingOperations` make reexecuting and
dependent operations the same set object.
Copy link

changeset-bot bot commented Sep 9, 2024

🦋 Changeset detected

Latest commit: f61408c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@urql/exchange-graphcache Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@JoviDeCroock
Copy link
Collaborator

Mind adding a changeset and a test that shows this behavior?

@xuanduc987
Copy link
Contributor Author

@JoviDeCroock I had added a new changeset.
About test, I took a look at cacheExchange.test.ts but still not sure how to test this.

@xuanduc987
Copy link
Contributor Author

@JoviDeCroock I added test to assert that the number of reexec after a query would not change after executing a mutation

@JoviDeCroock JoviDeCroock merged commit 31d161a into urql-graphql:main Sep 9, 2024
7 checks passed
@github-actions github-actions bot mentioned this pull request Sep 9, 2024
This pull request was closed.
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.

2 participants