Skip to content

fix(web): saving an unchanged citation comment no longer adds an empty undo step - #43446

Open
BenjaminPeters-code wants to merge 4 commits into
pingdotgg:mainfrom
BenjaminPeters-code:fix/cite-unchanged-comment-no-undo-step
Open

BenjaminPeters-code wants to merge 4 commits into
pingdotgg:mainfrom
BenjaminPeters-code:fix/cite-unchanged-comment-no-undo-step

Conversation

@BenjaminPeters-code

@BenjaminPeters-code BenjaminPeters-code commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Saving a citation comment always writes the citation node again, even when the comment did not change. Pressing Enter in the empty comment box of a new citation is the normal flow, so that save records an undo step that changes nothing. The first Cmd+Z after citing appears to do nothing; only the second removes the citation.

Steps (web, any thread with a response):

  1. Select text in a response and click Cite.
  2. Press Enter in the empty comment box.
  3. Press Cmd+Z.

Expected: the citation is removed.
Actual: the chip is still there. A second Cmd+Z removes it.

Change

onSaveComment returns early when the comment after trimming equals the saved one, so no transaction and no undo step are recorded. It still returns true, so Enter closes the box and save-and-send still sends.

Scope

A small fix of an obvious bug, so no issue. I searched open and closed issues and PRs for "undo citation", "undo cite composer", "Cmd+Z citation", "undo twice citation", "citation comment undo" and "cite undo", and found none. The only related item is #32550 (open, a Delete button for citations), whose undo work is about restoring a deleted citation, not this empty step.

Verification

  • New browser test in ComposerPromptEditorTiptap.citationDraft.browser.test.tsx: add a comment through the pencil, open it again and save it unchanged, then one undo must remove the comment. On main it fails: the prompt still has &comment=check after one undo, because that undo only reverted the empty step. With the fix it passes, which also shows that saving a changed comment is still one undo step. 6 passed.
  • vp run check:changed: format, lint, knip, typecheck, tests and React Compiler all pass.
  • The existing test "clears the sent prompt when an empty citation comment sends it" passes, so save-and-send with an unchanged comment still sends.
  • In the real web app (e2e scenario, headless Chromium, Replay provider) with the steps above: on main the chip is still there after one Cmd+Z; with the fix one Cmd+Z removes it.
  • Desktop app: checked in vp run dev:desktop (Electron) with this fix, against main on the same commit. Main shows the bug, this fix removes it.
  • Not checked: touch input. The mobile app has its own native composer and is not touched.

Before:

undo-before

After:

undo-after

Claude Opus 5.5 in Claude Code did the work.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The citation comment save handler now skips its node-update transaction when the submitted comment matches the existing comment. A browser test checks that undo restores the original prompt after an unchanged save.

Changes: Citation comment undo

Layer / File(s) Summary
Skip unchanged citation updates
apps/web/src/components/ComposerPromptEditorTiptap.tsx, apps/web/src/components/ComposerPromptEditorTiptap.citationDraft.browser.test.tsx
The save handler skips the node-update transaction when the comment is unchanged. The browser test saves an unchanged comment and checks that the platform-appropriate undo shortcut restores the original prompt.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Possibly related PRs

  • pingdotgg/t3code#33440: This PR changes the same onSaveComment flow and relies on its return-value contract.

Suggested labels: bugfix

Suggested reviewers: juliusmarminge, macroscopeapp

Merge Risk: Minimal · up to 2ab2f

Saving an unchanged citation comment no longer adds an empty undo step, and the change is small and localized. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: saving an unchanged citation comment no longer adds an empty undo step. It follows the conventional commit form and matches the code change (early return in onSaveComm…
Description check Passed The description covers the problem with reproduction steps and expected versus actual behavior. It explains the change and why no transaction is recorded. The scope section explains why no issue is li…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: saving an unchanged citation comment no longer adds an empty undo step. It follows the conventional commit form and matches the code change (early return in onSaveComment) and the new browser test. It is specific and not vague.

Full details: Description check

Explanation

The description covers the problem with reproduction steps and expected versus actual behavior. It explains the change and why no transaction is recorded. The scope section explains why no issue is linked and searches for duplicates. Verification lists focused tests, the existing test, web and desktop checks, and states what was not checked (touch input). It includes before and after screenshots. It follows the template closely and states the agent used, so it is complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between be12939 and 2ab2f57.

Files selected for processing: 1

  • apps/web/src/components/ComposerPromptEditorTiptap.citationDraft.browser.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 26, 2026
juliusmarminge and others added 2 commits November 26, 2026 12:10
…mment-no-undo-step

# Conflicts:
#	apps/web/src/components/ComposerPromptEditorTiptap.citationDraft.browser.test.tsx
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Linux Chromium 156, 1280×800, light theme; fresh isolated databases with identical synthetic Replay (dev) Showcase data.

Steps: open the finished response → select its final paragraph using the browser Selection API → click Cite → press Enter with the optional comment empty → press Ctrl+Z once.

Before After
Commit 12fda73203 5ac7520db3
Empty comment saved Before: saved empty comment After: saved empty comment
After one undo Before: citation remains After: citation removed
Result Citation count remains 1; scenario fails Citation count becomes 0; scenario passes
Recording Before interaction After interaction

Scenario source

The paired runner completed with exit 0; captures were visually inspected.

Not shown:

  • Saving an existing non-empty comment unchanged was not exercised.
  • macOS Cmd+Z was not exercised; this proof uses Linux Ctrl+Z.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 26, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

The automated pipeline stopped on this pull request and will not merge it:

someone else pushed to fix/cite-unchanged-comment-no-undo-step (head is now be12939); the pipeline does not build on commits it did not review

It stays open for a person to finish or close.

@juliusmarminge juliusmarminge added takeover:blocked Takeover blocked; reason in the PR body and removed takeover:ready Takeover done; auto-lands when gates pass labels Nov 26, 2026
…mment-no-undo-step

# Conflicts:
#	apps/web/src/components/ComposerPromptEditorTiptap.citationDraft.browser.test.tsx
@BenjaminPeters-code

Copy link
Copy Markdown
Contributor Author

Note

Claude Opus 5.5 posting on behalf of Benjamin

Sorry, my merges of main into this branch (be12939, 2ab2f57) stopped the pipeline. I only meant to clear the conflict after #43444 and #43445 landed. The fix itself is unchanged: against main the PR still only adds the early return in onSaveComment and its test. I won't push to this branch again; feel free to take it over, rebuild it, or close it in favour of your own commit.

This branch has not been deployed

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

Labels

size:XS 0-9 changed lines (additions + deletions). takeover:blocked Takeover blocked; reason in the PR body vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants