Skip to content

fix(comments): track change edits in body get matched in comments bubble#3305

Open
palmer-cl wants to merge 4 commits into
mainfrom
cp/update-tc-bubble-with-content
Open

fix(comments): track change edits in body get matched in comments bubble#3305
palmer-cl wants to merge 4 commits into
mainfrom
cp/update-tc-bubble-with-content

Conversation

@palmer-cl
Copy link
Copy Markdown
Collaborator

  • Before when you clicked inside a tracked change and typed more content, the comment bubble text would not update
  • After: comment bubble stays in sync with body text

@palmer-cl palmer-cl requested a review from a team as a code owner May 14, 2026 16:16
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0ff08d9296

ℹ️ 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".

Comment on lines +1197 to +1201
transaction.mapping.maps.forEach((stepMap) => {
stepMap.forEach((oldStart, oldEnd, newStart, newEnd) => {
const from = Math.max(0, newStart - 1);
const to = Math.min(transaction.doc.content.size, newEnd + 1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remap each changed range into final transaction doc

collectTouchedTrackedChangeIds iterates transaction.mapping.maps and then calls transaction.doc.nodesBetween(from, to, ...) using newStart/newEnd directly. For multi-step transactions, those coordinates are relative to each step’s intermediate post-step document, not always the final transaction.doc, so earlier steps can be scanned at the wrong offsets. In those cases touched tracked-change IDs are missed, queueTrackedChangeCommentResync receives an empty/incomplete set, and sidebar bubbles can stay stale after edits that produce multiple steps (for example IME/composition or other batched edits).

Useful? React with 👍 / 👎.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.63866% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/superdoc/src/SuperDoc.vue 91.66% 2 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@luccas-harbour luccas-harbour left a comment

Choose a reason for hiding this comment

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

hi @palmer-cl!
I tested this in the browser and seem to have found an issue. The problem is happening when I added text to a track change. As I am typing, a new letter "e" is appended to the end of the run. Here's a video showing that: https://www.loom.com/share/f7051ffbf4c3413fae367a2397dce463
In the test I am using the basic/advanced-text.docx document from our test corpus.

Also, a codex review found this issue:

  • [P2] Handle touched tracked changes that disappear — packages/superdoc/src/SuperDoc.vue:1202-1205
    When a normal edit removes all content carrying an existing tracked-change mark, such as backspacing over the entire text of your own tracked insertion, this scan only inspects transaction.doc after the change. At that point there is no mark left for nodesBetween to find, so the old change id is never queued for refresh/resolve and the comments sidebar can keep showing a stale tracked-change bubble. Capture the touched id from the pre-change range or resolve the matching comment when a queued id has no remaining marks.

Can you please check these? Thank you!

Comment on lines +20 to +26
const isShallowEqual = (a, b) => {
if (Object.is(a, b)) return true;
if (!a || !b || typeof a !== 'object' || typeof b !== 'object') return false;
const keysA = Object.keys(a);
const keysB = Object.keys(b);
return keysA.length === keysB.length && keysA.every((key) => Object.is(a[key], b[key]));
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

shallowEqual already exists at packages/super-editor/src/ui/equality.ts:12, is re-exported from @superdoc/super-editor, and even has a public sub-entry at packages/superdoc/src/ui.js:13. the published one handles arrays explicitly and uses hasOwnProperty. mind swapping to import { shallowEqual } from '@superdoc/super-editor'; and dropping the local copy?

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.

4 participants