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