diff --git a/packages/components/src/components/SquiggleEditor.tsx b/packages/components/src/components/SquiggleEditor.tsx index 8ea70afa..9a453ab8 100644 --- a/packages/components/src/components/SquiggleEditor.tsx +++ b/packages/components/src/components/SquiggleEditor.tsx @@ -166,7 +166,7 @@ export let SquigglePartial: React.FC = ({ let [expression, setExpression] = React.useState(initialSquiggleString); let [error, setError] = React.useState(null); - React.useEffect(() => { + let runSquiggleAndUpdateBindings = () => { let squiggleResult = runPartial( expression, bindings, @@ -179,7 +179,9 @@ export let SquigglePartial: React.FC = ({ } else { setError(errorValueToString(squiggleResult.value)); } - }, [expression]); + }; + + React.useEffect(runSquiggleAndUpdateBindings, [expression]); return (