Core Data: Prevent unchanged synced records from being marked as edited - #81289
Core Data: Prevent unchanged synced records from being marked as edited#81289tyxla wants to merge 1 commit into
Conversation
|
Size Change: +49 B (0%) Total Size: 7.81 MB 📦 View Changed
|
|
Flaky tests detected in 0d6c8e7. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/31110413426 three users concurrently edit a large post with diverse blocks in
|
youknowriad
left a comment
There was a problem hiding this comment.
I think this is a good idea, but I thought we were doing it already. So I'm going to do some digging to check whether this is redundant code or not.
|
The sync manager does this I can't tell for sure how redundant is that code with the code you added. |
|
Happy to drop or move with it - let me know. It's a bit trickier since we might be dealing with situations that we don't have clear reproduction steps for. |
What?
Prevents synced entity updates from marking a record as edited when the incoming values are unchanged.
See #79776.
Why?
The unsaved-changes warning checks Core Data for dirty entity records. Synced updates could bypass the usual unchanged-value filtering and create an edit even when the incoming data matched the persisted record, causing a false leave-page warning.
How?
Normalize synced edits against the persisted entity record before dispatching them.
Unchanged updates are ignored, while genuine remote changes are still applied. The implementation also preserves the case where a synced update restores the persisted value and needs to clear an existing local edit.
Testing Instructions
Testing Instructions for Keyboard
There are no user-interface changes.
Screenshots or screencast
Not applicable.
Use of AI Tools
Codex was used to investigate the issue and assist with the implementation, tests, and PR description. The resulting changes were reviewed and verified by the author.