fix(tracked-changes): sync tracked changes store on undo and redo#2164
fix(tracked-changes): sync tracked changes store on undo and redo#2164
Conversation
palmer-cl
commented
Feb 24, 2026
- fix undo and redo logic with tracked changes
- add behavior tests and visual tests
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48eb61710e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
packages/superdoc/src/components/CommentsLayer/FloatingComments.vue
Outdated
Show resolved
Hide resolved
caio-pizzol
left a comment
There was a problem hiding this comment.
solid fix - guard removal + explicit sync on undo/redo addresses the actual data flow gap (PR #2195 will prob conflict here)
| if (!Object.keys(currentPositions).length) return 0; | ||
|
|
||
| const toNormalizedId = (id) => (id === undefined || id === null ? null : String(id)); | ||
| const getCommentAliasIds = (comment) => |
There was a problem hiding this comment.
alias strategies are different in three places - store's getCommentAliasIds includes getCommentPositionKey, vue's version only uses [importedId, commentId], and getFloatingComments uses commentId || importedId.
they converge for new tracked changes but will mismatch on imported docs with both IDs.
| @@ -823,9 +932,6 @@ export const useCommentsStore = defineStore('comments', () => { | |||
| * @returns {void} | |||
| */ | |||
| const handleEditorLocationsUpdate = (allCommentPositions) => { | |||
There was a problem hiding this comment.
correct for undo, but changes behavior for all callers.
heads up: #2195 is incoming and touches the same files (FloatingComments.vue, comments-store.js, SuperDoc.vue) - it adds stale cleanup in FloatingComments that mitigates any flicker from transient empty payloads, so should be safe once both land