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(core): do not update completed mutations #7104
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit b230873:
|
@@ -169,4 +169,128 @@ describe('mutationObserver', () => { | |||
|
|||
unsubscribe() | |||
}) | |||
|
|||
test('changing mutation meta should not affect successful mutations', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be good to also test the following scenario:
- set meta to
{ a: 1 }
- call
mutate
, wait until it's done - trigger a re-render, update meta to
{ a: 2 }
- call
mutate
again, wait until it's done
after that, we should have two mutations in the cache, where the first one has { a: 1 }
and the second one has { a: 2 }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, added a test mutation cache should have different meta when updated between mutations
in the latest commit. Also changed meta property names from count
to a
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a
was just an example, you didn't need to rename it 😂
☁️ Nx Cloud ReportCI is running/has finished running commands for commit b230873. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
please fix formatting |
Sorry about that, should be fixed now |
fixes #6839
This PR fixes that updating options on a mutation will update the latest mutation in the cache, even though it is completed.