fix(datagrid): redraw cells after Cmd+Z when editor view briefly disappears#983
Merged
fix(datagrid): redraw cells after Cmd+Z when editor view briefly disappears#983
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
After editing a cell and pressing Cmd+Z, the yellow "modified" cell background and the modified-row highlight stayed on screen, even though
pendingChangesand the toolbar Save button correctly cleared. The redraw call after undo was silently dropped.Root cause:
MainEditorContentViewwas wiring its@StatedataTabDelegateintocoordinator.dataTabDelegate(aweakref) on.onAppear, and explicitly nilling that ref on.onDisappear. SwiftUI firesonDisappearon transient lifecycle events even when the@Statestrong owner persists, so the wire briefly went nil between the cell edit and the Cmd+Z dispatch.handleUndoResultthen walked throughdataTabDelegate?.tableViewCoordinator?.invalidateCachesForUndoRedo()and got an early-out via the nil chain.The explicit nil is unnecessary.
weak varclears itself when the@Statestrong owner is finally deallocated on permanent view destruction. Until then the wire stays valid through hide/show cycles. Same fix protects every other coordinator method that hitsdataTabDelegate?.tableViewCoordinator?...(delete, paste, duplicate, load-more, undo-insert, etc.) which were all silently no-oping on the same code path.Test plan