Skip to content

SD-2277 - fix: tracked change doesn't undo correctly#2658

Merged
caio-pizzol merged 12 commits intomainfrom
gabriel/sd-2277-bug-tracked-change-text-becomes-inaccurate-after-undoredo
Apr 2, 2026
Merged

SD-2277 - fix: tracked change doesn't undo correctly#2658
caio-pizzol merged 12 commits intomainfrom
gabriel/sd-2277-bug-tracked-change-text-becomes-inaccurate-after-undoredo

Conversation

@chittolinag
Copy link
Copy Markdown
Contributor

@chittolinag chittolinag commented Mar 31, 2026

Issue

Tracked-change bubbles weren’t updated when the history replay rebuilt suggestions, so undoing part of an insertion (typing “add text” → undoing “ text”) removed those characters from the document but left the sidebar bubble showing “add text.”

Fix

This fix makes syncTrackedChangeComments() re-run createOrUpdateTrackedChangeComment() in “update” mode for existing suggestions, making sure that replay re-calculates the tracked-change text/deletion payload from the current state before emitting the bubble update.

The fix keeps full metadata per tracked-change ID (runtime ID + imported ID) and adds a refreshExisting mode. When replay runs, the helper now:

  1. Collects existing unresolved tracked-change comments and memoizes them by ID.
  2. When we find a grouped change whose ID already exists, we let it through and call createOrUpdateTrackedChangeComment() with event: 'update'.
  3. The update path re-extracts insertion/deletion text directly from the doc and emits the updated payload via handleTrackedChangeUpdate().

@linear
Copy link
Copy Markdown

linear bot commented Mar 31, 2026

@chittolinag chittolinag changed the title fix: tracked change doesn't undo correctly SD-2277 - fix: tracked change doesn't undo correctly Mar 31, 2026
@chittolinag chittolinag marked this pull request as ready for review March 31, 2026 15:06
Copy link
Copy Markdown
Contributor

@caio-pizzol caio-pizzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chittolinag looks good! tested locally — undo/redo updates the sidebar bubble correctly now. one small cleanup inline.

chittolinag and others added 2 commits April 1, 2026 11:38
Co-authored-by: Caio Pizzol <97641911+caio-pizzol@users.noreply.github.com>
@chittolinag chittolinag requested a review from caio-pizzol April 1, 2026 14:43
Copy link
Copy Markdown
Contributor

@caio-pizzol caio-pizzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chittolinag lgtm! added a test for the bubble text after undo/redo, all green.

@caio-pizzol caio-pizzol added this pull request to the merge queue Apr 2, 2026
@caio-pizzol caio-pizzol removed this pull request from the merge queue due to a manual request Apr 2, 2026
@caio-pizzol caio-pizzol enabled auto-merge April 2, 2026 20:37
@caio-pizzol caio-pizzol disabled auto-merge April 2, 2026 20:37
@caio-pizzol caio-pizzol enabled auto-merge April 2, 2026 20:37
@caio-pizzol caio-pizzol added this pull request to the merge queue Apr 2, 2026
Merged via the queue into main with commit 7f4133a Apr 2, 2026
53 checks passed
@caio-pizzol caio-pizzol deleted the gabriel/sd-2277-bug-tracked-change-text-becomes-inaccurate-after-undoredo branch April 2, 2026 20:44
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 3, 2026

🎉 This PR is included in vscode-ext v1.1.0-next.60

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 3, 2026

🎉 This PR is included in @superdoc-dev/react v1.0.0-next.14

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 3, 2026

🎉 This PR is included in template-builder v1.3.0-next.17

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 3, 2026

🎉 This PR is included in esign v2.2.0-next.18

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 3, 2026

🎉 This PR is included in superdoc-cli v0.5.0-next.57

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 3, 2026

🎉 This PR is included in superdoc v1.24.0-next.57

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 3, 2026

🎉 This PR is included in superdoc-sdk v1.3.0-next.58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants