Skip to content

Commit 13c0f82

Browse files
wkqdylans
andcommitted
fix: correct dirty path update for Text nodes (ianstormtaylor#5842)
* fix: correct dirty path update for Text nodes Previously, the condition used was "if (!Text.isText)" without passing the node, which always evaluated to false. This caused the code to always take the branch intended for non-Text nodes, even for Text nodes. The fix now correctly checks "if (Text.isText(node))" to determine if the node is a Text node. Text nodes, which have no children, will now correctly add only their own path, while non-Text nodes continue to have all their descendant paths added. This change ensures that the dirty path update logic behaves as intended. * Add changeset --------- Co-authored-by: Dylan Schiemann <[email protected]>
1 parent 4facc3b commit 13c0f82

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/clever-moose-exist.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'slate': patch
3+
---
4+
5+
fix: correct dirty path update for Text nodes

packages/slate/src/transforms-node/insert-nodes.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export const insertNodes: NodeTransforms['insertNodes'] = (
120120
at = Path.next(at as Path)
121121

122122
batchedOps.push(op)
123-
if (!Text.isText) {
123+
if (Text.isText(node)) {
124124
newDirtyPaths.push(path)
125125
} else {
126126
newDirtyPaths.push(

0 commit comments

Comments
 (0)