diff --git a/website/src/repl/Repl.jsx b/website/src/repl/Repl.jsx index 3d3117ae..7813ae98 100644 --- a/website/src/repl/Repl.jsx +++ b/website/src/repl/Repl.jsx @@ -247,9 +247,15 @@ export function Repl({ embedded = false }) { stop(); } }; - const handleUpdate = (newCode) => { + const handleUpdate = async (newCode, reset = false) => { + if (reset) { + clearCanvas(); + resetLoadedSounds(); + scheduler.setCps(1); + await prebake(); // declare default samples + } (newCode || isDirty) && activateCode(newCode); - logger('[repl] code updated! tip: you can also update the code by pressing ctrl+enter', 'highlight'); + logger('[repl] code updated!'); }; const handleShuffle = async () => {