From 298fdeb26dfc342f01d96427e6b0db1969eaed43 Mon Sep 17 00:00:00 2001 From: marc2332 Date: Sun, 9 Feb 2025 13:04:23 +0100 Subject: [PATCH] fix: Dont check for cursor state in mutations writer --- crates/core/src/dom/mutations_writer.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/core/src/dom/mutations_writer.rs b/crates/core/src/dom/mutations_writer.rs index 9dca5cb92..a68c1cfdb 100644 --- a/crates/core/src/dom/mutations_writer.rs +++ b/crates/core/src/dom/mutations_writer.rs @@ -69,9 +69,8 @@ impl<'a> MutationsWriter<'a> { } let layer_state = node.get::(); - let cursor_state = node.get::(); - let Some((layer_state, cursor_state)) = layer_state.zip(cursor_state) else { + let Some(layer_state) = layer_state else { // There might exist Nodes in the RealDOM with no states yet, // this is mainly due to nodes being created in the same run as when this function (remove) is being called, // like nodes created by loaded templates. @@ -94,9 +93,11 @@ impl<'a> MutationsWriter<'a> { .remove_node_from_layer(node_id, layer_state.layer); // Remove from paragraph elements - if let Some(cursor_ref) = cursor_state.cursor_ref.as_ref() { - self.paragraphs - .remove_paragraph(node_id, &cursor_ref.text_id); + if let Some(cursor_state) = node.get::() { + if let Some(cursor_ref) = cursor_state.cursor_ref.as_ref() { + self.paragraphs + .remove_paragraph(node_id, &cursor_ref.text_id); + } } // Remove from the accessibility tree