feat(message-editor): double paste to undo chip auto-conversion - #3454
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
|
Reviews (1): Last reviewed commit: "double paste to undo chip auto-conversio..." | Re-trigger Greptile |
There was a problem hiding this comment.
Focused UX feature replacing click-to-undo with double-paste for chip auto-conversion. Race conditions are handled correctly: the cancel path dispatches text synchronously rather than waiting for persistence, and the chipId-based doc walk correctly guards against stale undos. Both bot comments are resolved and the analysis confirms the code addresses them.
New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.
There was a problem hiding this comment.
No showstoppers. The chipId attribute was already in the node schema; the race-condition handling via the canceled flag is correct given JS's single-threaded event loop; the doc-walk caret guard prevents stale undos; and both bot concerns are properly addressed in the current diff.
New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.
New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.
There was a problem hiding this comment.
Clean UX feature replacing click-to-undo with double-paste for chip auto-conversion. Both bot-raised concerns (async race on canceled paste, rich-text insertText) are correctly addressed in the diff. Architecture is sound, tests cover the new utility modules, and the canceled-flag state machine is correct for JS's single-threaded event model.
Problem
Pasting a GitHub issue/PR URL or long text into the composer auto-converts it to a chip. When you wanted the raw text instead, undoing that means knowing about Cmd+Shift+V ahead of time.
Changes
Pasting the same clipboard again right after an auto-conversion now replaces the chip with the plain text. Covers GitHub ref chips and long-text attachment chips. A repeat paste that lands before the text finishes persisting inserts the text immediately at the paste position instead of waiting on the file write. It only fires while the caret still follows the chip, so typing or moving the caret between pastes keeps normal paste behavior.
Double paste is now the only un-convert path: the click-to-convert behavior on pasted-text chips is removed and their tooltip says "Paste again to expand as text".
The first-time hint toast teaches the gesture and can be acknowledged with "Got it" to never show again (it also stops once the user double-pastes, or after 3 showings):
After pasting the same clipboard again, the chip expands back to the raw text:
How did you test this?
@posthog/core(paste.test.ts).pnpm typecheckandbiome lint packages/core(zeronoRestrictedImports).Automatic notifications