diff --git a/packages/react/src/hooks/useStrudel.mjs b/packages/react/src/hooks/useStrudel.mjs index 223c21ba..d1b256c3 100644 --- a/packages/react/src/hooks/useStrudel.mjs +++ b/packages/react/src/hooks/useStrudel.mjs @@ -73,8 +73,11 @@ function useStrudel({ } }); const activateCode = useCallback( - async (autostart = true) => { - const res = await evaluate(code, autostart); + async (newCode, autostart = true) => { + if (newCode) { + setCode(code); + } + const res = await evaluate(newCode || code, autostart); broadcast({ type: 'start', from: id }); return res; }, diff --git a/website/src/repl/Repl.jsx b/website/src/repl/Repl.jsx index 1e90f2fb..94d1b695 100644 --- a/website/src/repl/Repl.jsx +++ b/website/src/repl/Repl.jsx @@ -225,8 +225,8 @@ export function Repl({ embedded = false }) { stop(); } }; - const handleUpdate = () => { - isDirty && activateCode(); + const handleUpdate = (newCode) => { + (newCode || isDirty) && activateCode(newCode); logger('[repl] code updated! tip: you can also update the code by pressing ctrl+enter', 'highlight'); }; diff --git a/website/src/repl/panel/Panel.jsx b/website/src/repl/panel/Panel.jsx index 430e9835..0642bdea 100644 --- a/website/src/repl/panel/Panel.jsx +++ b/website/src/repl/panel/Panel.jsx @@ -10,6 +10,7 @@ import { Reference } from './Reference'; import { SettingsTab } from './SettingsTab'; import { SoundsTab } from './SoundsTab'; import { WelcomeTab } from './WelcomeTab'; +import { PatternsTab } from './PatternsTab'; const TAURI = window.__TAURI__; @@ -54,7 +55,7 @@ export function Panel({ context }) { }, []), ); - const FooterTab = ({ children, name, label }) => ( + const PanelTab = ({ children, name, label }) => ( <>