From 335c54188ff1e2985cc584dd9fa3117508208dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Sartorio?= Date: Thu, 26 Sep 2024 04:24:33 -0300 Subject: [PATCH] Call unref on pathRefs created for move_node (#5727) * Call unref on pathRefs created for move_node * Create old-frogs-run.md --------- Co-authored-by: Dylan Schiemann --- .changeset/old-frogs-run.md | 5 +++++ packages/slate-react/src/plugin/with-react.ts | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 .changeset/old-frogs-run.md diff --git a/.changeset/old-frogs-run.md b/.changeset/old-frogs-run.md new file mode 100644 index 0000000000..e35ff8bba2 --- /dev/null +++ b/.changeset/old-frogs-run.md @@ -0,0 +1,5 @@ +--- +'slate-react': patch +--- + +Call unref on pathRefs created for move_node to remove memory leak diff --git a/packages/slate-react/src/plugin/with-react.ts b/packages/slate-react/src/plugin/with-react.ts index 395f208ddb..852bc91ebc 100644 --- a/packages/slate-react/src/plugin/with-react.ts +++ b/packages/slate-react/src/plugin/with-react.ts @@ -216,6 +216,8 @@ export const withReact = ( const [node] = Editor.node(e, pathRef.current) NODE_TO_KEY.set(node, key) } + + pathRef.unref() } }