From 52eaf00fb61d011798b3fc173041a6ae344aa500 Mon Sep 17 00:00:00 2001 From: Jakob Date: Mon, 17 Jun 2024 14:34:35 -0700 Subject: [PATCH] fix infinite loop in text editor window --- .../client/editor/src/components/TextEditorWindow/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/editor/src/components/TextEditorWindow/index.tsx b/packages/client/editor/src/components/TextEditorWindow/index.tsx index 9b11f525e4..9001fdec63 100644 --- a/packages/client/editor/src/components/TextEditorWindow/index.tsx +++ b/packages/client/editor/src/components/TextEditorWindow/index.tsx @@ -129,10 +129,10 @@ const TextEditor = () => { const formattedCode = code.replace('\r\n', '\n') if (formattedCode === activeInput.value) return - if (activeInput) { + if (selectedNode.id === activeInput.nodeId) { dispatch(setActiveInput({ ...activeInput, value: formattedCode })) } - }, [debouncedCode, activeInput, selectedNode]) + }, [code, activeInput, selectedNode, dispatch]) // Handles loading the code from selected node if a text editor data node useEffect(() => {