fix: merge consecutive text ops when one undoStepId is undefined#2334
Open
christianhg wants to merge 1 commit intomainfrom
Open
fix: merge consecutive text ops when one undoStepId is undefined#2334christianhg wants to merge 1 commit intomainfrom
christianhg wants to merge 1 commit intomainfrom
Conversation
When a forward-only behavior intercepts a typing event, the operation gets applied with an undoStepId from the send entry. The next keystroke (without a behavior) has undoStepId undefined. Previously, this mismatch prevented the consecutive insert_text merge heuristic from running. Now createUndoSteps tries the text merge heuristic when the current operation has no undoStepId but the previous one did. The reverse case (current has ID, previous doesn't) is intentionally not merged, as it indicates a behavior deliberately claimed the event.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 1513782 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 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 (be4d3b8) |
|---|---|---|
| Internal (raw) | 811.2 KB | +518 B, +0.1% |
| Internal (gzip) | 151.5 KB | +14 B, +0.0% |
| Bundled (raw) | 1.42 MB | +518 B, +0.0% |
| Bundled (gzip) | 314.4 KB | +12 B, +0.0% |
| Import time | 101ms | +0ms, +0.0% |
@portabletext/editor/behaviors
| Metric | Value | vs main (be4d3b8) |
|---|---|---|
| Internal (raw) | 467 B | - |
| Internal (gzip) | 207 B | - |
| Bundled (raw) | 424 B | - |
| Bundled (gzip) | 171 B | - |
| Import time | 6ms | -0ms, -0.2% |
@portabletext/editor/plugins
| Metric | Value | vs main (be4d3b8) |
|---|---|---|
| Internal (raw) | 2.5 KB | - |
| Internal (gzip) | 910 B | - |
| Bundled (raw) | 2.3 KB | - |
| Bundled (gzip) | 839 B | - |
| Import time | 12ms | -0ms, -0.7% |
@portabletext/editor/selectors
| Metric | Value | vs main (be4d3b8) |
|---|---|---|
| Internal (raw) | 60.2 KB | - |
| Internal (gzip) | 9.4 KB | - |
| Bundled (raw) | 56.7 KB | - |
| Bundled (gzip) | 8.6 KB | - |
| Import time | 11ms | +0ms, +3.0% |
@portabletext/editor/utils
| Metric | Value | vs main (be4d3b8) |
|---|---|---|
| Internal (raw) | 24.2 KB | - |
| Internal (gzip) | 4.7 KB | - |
| Bundled (raw) | 22.2 KB | - |
| Bundled (gzip) | 4.4 KB | - |
| Import time | 9ms | -0ms, -1.4% |
Details
- Import time regressions over 10% are flagged with
⚠️ - Treemap artifacts are attached to the CI run for detailed size analysis
- Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
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.
Companion to #2243. That PR fixed the case where both undoStepIds are defined but different (consecutive forwarded events). This PR fixes the remaining case where the current operation has no undoStepId but the previous one did.
This happens when a forward-only behavior intercepts one keystroke (giving it an undoStepId from the send entry) but the next keystroke has no matching behavior (so its undoStepId is undefined). The mismatch prevented the consecutive insert_text merge heuristic from running, making each keystroke its own undo step.
The reverse case (current has ID, previous doesn't) is intentionally not merged. When a behavior claims an event and gets an undoStepId, that signals an intentional undo step boundary, like input rules replacing
->with→.