Repository navigation
fix: stop crashing on a span where a block belongs and on children: null - #3695
christianhg wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: ebea023 The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 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 |
Bundle Stats✅ No significant changes. All scenario measurements (34)🗺️
Significant means at least 1.0 KB and 1% gzip, or at least 5 ms and 10% import time. |
c7731c1 to
d410e08
Compare
Pin rendering and typing around spans where blocks belong. Assert preservation of keyless spans without `text` or `marks`. Assert duplicate-key repair after collaborator inserts at each depth. Apply the Backspace patch with `applyAll` to verify it removes only that span. Pin exact undo and redo patches for keyed and keyless spans. Move the six `children: null` validation cases to `validateValue` unit tests. Keep the `children: "oops"` control there too. Retain a browser case that types after the invalid-value event without applying its resolution.
`useChildren` sent every span to the text renderer. At a block position the span has no text block parent, so the renderer threw. Render those spans as selectable block objects. Keep their text hidden. Narrow the node once with `isTypedObject` before comparing its type. `isSpanNode` does not provide the index signature the object renderer requires. `normalizeNode` retains only duplicate-key corrections for those spans. Main's repair renames the later copy of a shared key. Reuse the normal correction path so its dirty-path re-queue still runs. Skip every other correction. Missing and empty `_key` values stay as received. `isLeafObject` recognizes the span as a leaf object. Check the empty container registry before the span guard in `isEditableContainer`. `isLeafObject` and `isEditableContainer` call `isBlock` only for a span. `getDomNodePath` turns an all-digit last segment into an index only on a block object element. Field names made of digits stay strings. Backspace deletes the selected span with one `unset` patch.
`validateValue` let `children: null` reach array methods and throw. Treat `null` as an invalid `children` property. The editor emits an `invalid value` event with a resolution that resets `children` to an empty array. It does not apply the proposed patches. `children` set to `false`, `0` or `''` still throws.
d410e08 to
ebea023
Compare
A span that arrives where a block belongs no longer crashes the editor. This happens inside a callout, a nested callout or a table cell, through the start value,
update valueor a collaborator's patches. It also happens at the root through a collaborator's patches. The span is now drawn as a block object, like a block whose type the schema does not know. Its fields stay as received and its text is not shown. The editor emits no correction patches for it, except to rename a_keyit shares with a sibling. A missing or empty_keystays as received. Clicking it selects it, and Backspace deletes it with oneunsetpatch. At the root, the start value andupdate valuestill reportinvalid valuewith the "Remove the block" resolution, as before.A text block with
children: nullno longer crashes validation. It gets the sameinvalid valueevent as any otherchildrenthat is not an array, which offers to resetchildrento an empty array. The proposed patches are not applied.