fix: merge consecutive text operations across forward-only behavior undo step boundary - #2747
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 0a7de60 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
📦 Bundle Stats —
|
| Metric | Value | vs main (22f6aa0) |
|---|---|---|
| Internal (raw) | 777.5 KB | +360 B, +0.0% |
| Internal (gzip) | 147.7 KB | +8 B, +0.0% |
| Bundled (raw) | 1.38 MB | +360 B, +0.0% |
| Bundled (gzip) | 309.6 KB | +13 B, +0.0% |
| Import time | 97ms | +2ms, +1.6% |
@portabletext/editor/behaviors
| Metric | Value | vs main (22f6aa0) |
|---|---|---|
| Internal (raw) | 467 B | - |
| Internal (gzip) | 207 B | - |
| Bundled (raw) | 424 B | - |
| Bundled (gzip) | 171 B | - |
| Import time | 2ms | -0ms, -1.6% |
@portabletext/editor/plugins
| Metric | Value | vs main (22f6aa0) |
|---|---|---|
| Internal (raw) | 2.7 KB | - |
| Internal (gzip) | 894 B | - |
| Bundled (raw) | 2.5 KB | - |
| Bundled (gzip) | 827 B | - |
| Import time | 7ms | +0ms, +0.7% |
@portabletext/editor/selectors
| Metric | Value | vs main (22f6aa0) |
|---|---|---|
| Internal (raw) | 79.4 KB | - |
| Internal (gzip) | 14.5 KB | - |
| Bundled (raw) | 74.9 KB | - |
| Bundled (gzip) | 13.4 KB | - |
| Import time | 8ms | -0ms, -0.1% |
@portabletext/editor/traversal
| Metric | Value | vs main (22f6aa0) |
|---|---|---|
| Internal (raw) | 25.5 KB | - |
| Internal (gzip) | 5.0 KB | - |
| Bundled (raw) | 25.5 KB | - |
| Bundled (gzip) | 5.0 KB | - |
| Import time | 6ms | +0ms, +3.3% |
@portabletext/editor/utils
| Metric | Value | vs main (22f6aa0) |
|---|---|---|
| Internal (raw) | 28.8 KB | - |
| Internal (gzip) | 6.0 KB | - |
| Bundled (raw) | 26.7 KB | - |
| Bundled (gzip) | 5.7 KB | - |
| Import time | 6ms | -0ms, -0.6% |
🗺️ . · ./behaviors · ./plugins · ./selectors · ./traversal · ./utils · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — @portabletext/markdown
Compared against main (22f6aa01)
| Metric | Value | vs main (22f6aa0) |
|---|---|---|
| Internal (raw) | 53.0 KB | - |
| Internal (gzip) | 9.6 KB | - |
| Bundled (raw) | 347.6 KB | - |
| Bundled (gzip) | 96.0 KB | - |
| Import time | 40ms | +1ms, +1.5% |
🗺️ View treemap · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
…ndo step boundary
christianhg
force-pushed
the
fix/undo-merge-forward-only-behavior
branch
from
June 5, 2026 08:02
0160ea8 to
0a7de60
Compare
christianhg
enabled auto-merge (rebase)
June 5, 2026 08:08
Merged
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a forward-only behavior intercepts one keystroke and the next keystroke has no matching behavior, the two ops land in separate undo steps even though the user perceives them as continuous typing. The intercepted keystroke gets an
undoStepIdfrom themode === 'send' && !isNativeBehaviorEventbranch inperform-event.ts; the next keystroke flows through the native input path withundoStepIdundefined. ThecreateUndoStepsmerge heuristic has branches for both-undefined and both-defined-different, but no branch for the current-undefined / previous-defined mismatch — so the merge skips and each keystroke becomes its own step.The fix adds the symmetric merge branch for that case. The reverse direction (current defined, previous undefined) intentionally stays unmerged: a behavior claiming an event with an
undoStepIdsignals an intentional undo step boundary, like input rules replacing->with→.Picks up the work from #2334 — the underlying gap still existed after the renames in #2700 and the
createUndoStepsreorder in #2739.Tests
tests/event.history.undo.test.tsx— a forward-only behavior oninsert.textwithtext === 'a', thenuserEvent.type'a' followed by 'b'. With the merge gap, onehistory.undoonly pops the 'b' step, leaving "a"; with the symmetric branch, one undo restores the empty initial value. Fails onmain, passes here.