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: prevent rollbackRelationships from setting remoteState and localState to the same array reference #9221

Merged
merged 2 commits into from
Feb 12, 2024

Conversation

runspired
Copy link
Contributor

fixes #9207

Adds the test from that PR. Root cause is that typically we can presume replaceRelatedRecords is receiving an array reference it can safely re-use for localState/remoteState as appropriate. However in this case we generate the operation from the existing remoteState array and so this led to the two arrays having the same reference.

This meant that the next mutation on localState was then partially reflected into remoteState, preventing rollbackRelationships from working properly. Only partially reflected because the bookkeeping sets would still see this relationship as empty remotely.

@runspired runspired added 🎯 release PR should be backported to release 🎯 canary PR is targeting canary (default) 🎯 lts The PR should be backported to the most recent LTS 🏷️ bug This PR primarily fixes a reported issue lts-4-12 Long Term LTS Maintenance and removed 🎯 lts The PR should be backported to the most recent LTS lts-4-12 Long Term LTS Maintenance labels Feb 12, 2024
@runspired runspired merged commit ed00731 into main Feb 12, 2024
19 of 20 checks passed
@runspired runspired deleted the fix-9207 branch February 12, 2024 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎯 canary PR is targeting canary (default) 🎯 release PR should be backported to release 🏷️ bug This PR primarily fixes a reported issue
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

cache.rollbackRelationships does not rollback the 2nd time after adding a record and rollback again
2 participants