fix dependency array

This commit is contained in:
Felix Roos 2023-01-14 10:48:52 +01:00
parent 9afddf0850
commit 88684d6d9e

View File

@ -12,8 +12,8 @@ function useStrudel({
initialCode = '',
autolink = false,
beforeEval,
editPattern,
afterEval,
editPattern,
onEvalError,
onToggle,
canvasId,
@ -105,11 +105,11 @@ function useStrudel({
const inited = useRef();
useEffect(() => {
if (!inited.current && drawContext && onDraw && evalOnMount && code) {
if (!inited.current && evalOnMount && code) {
inited.current = true;
evaluate(code, false).then((pat) => drawFirstFrame(pat));
}
}, [activateCode, evalOnMount, code, drawFirstFrame]);
}, [evalOnMount, code, evaluate, drawFirstFrame]);
// this will stop the scheduler when hot reloading in development
useEffect(() => {