Skip to content

fix: assert numeric last segment on insert_node operations#2356

Closed
christianhg wants to merge 1 commit intomainfrom
fix/assert-insert-node-numeric-path
Closed

fix: assert numeric last segment on insert_node operations#2356
christianhg wants to merge 1 commit intomainfrom
fix/assert-insert-node-numeric-path

Conversation

@christianhg
Copy link
Member

Adds a runtime assertion in Transforms.transform that throws if an insert_node operation has a non-numeric last path segment.

insert_node requires a numeric index because the node doesn't exist in the array yet — you can't find it by key. Without this assertion, a keyed last segment silently gets coerced, causing corrupted tree state that's hard to trace back to the source.

No changeset needed — this is an internal assertion that doesn't change behavior for correct code.

@vercel
Copy link

vercel bot commented Mar 12, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
portable-text-editor-documentation Ready Ready Preview, Comment Mar 12, 2026 9:29am
portable-text-example-basic Ready Ready Preview, Comment Mar 12, 2026 9:29am
portable-text-playground Ready Ready Preview, Comment Mar 12, 2026 9:29am

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Mar 12, 2026

⚠️ No Changeset found

Latest commit: ff6552c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Mar 12, 2026

📦 Bundle Stats — @portabletext/editor

Compared against main (d992e30c)

@portabletext/editor

Metric Value vs main (d992e30)
Internal (raw) 775.7 KB +264 B, +0.0%
Internal (gzip) 144.5 KB +65 B, +0.0%
Bundled (raw) 1.38 MB +264 B, +0.0%
Bundled (gzip) 307.5 KB +52 B, +0.0%
Import time 91ms -3ms, -3.1%

@portabletext/editor/behaviors

Metric Value vs main (d992e30)
Internal (raw) 467 B -
Internal (gzip) 207 B -
Bundled (raw) 424 B -
Bundled (gzip) 171 B -
Import time 6ms -0ms, -3.4%

@portabletext/editor/plugins

Metric Value vs main (d992e30)
Internal (raw) 2.5 KB -
Internal (gzip) 910 B -
Bundled (raw) 2.3 KB -
Bundled (gzip) 839 B -
Import time 11ms -0ms, -3.6%

@portabletext/editor/selectors

Metric Value vs main (d992e30)
Internal (raw) 60.2 KB -
Internal (gzip) 9.4 KB -
Bundled (raw) 56.7 KB -
Bundled (gzip) 8.6 KB -
Import time 10ms -1ms, -4.9%

@portabletext/editor/utils

Metric Value vs main (d992e30)
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.7%
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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant