From b0522d8b0fa201aaf5cb5014354f9dcbfc971fb5 Mon Sep 17 00:00:00 2001 From: Jose Luis Date: Sat, 21 Mar 2026 20:54:18 +0100 Subject: [PATCH] fix: don't overwrite Workshop-loaded patch with autoLoad/chiptune When switching from Workshop to Sandbox after loading a patch, the Sandbox's useEffect was running autoLoad() which overwrote the just-loaded patch. Now it skips if modules are already present. Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/client/src/App.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/src/App.jsx b/packages/client/src/App.jsx index b0b2082..b12a535 100644 --- a/packages/client/src/App.jsx +++ b/packages/client/src/App.jsx @@ -38,11 +38,11 @@ export default function App({ onSwitchToGame, onSwitchToWorkshop }) { return unsub; }, []); - // Auto-load on mount, or load chiptune demo if empty + // Auto-load on mount, but skip if modules already loaded (e.g. from Workshop) useEffect(() => { + if (state.modules.length > 0) return; // Already loaded (Workshop, etc.) const loaded = autoLoad(); if (!loaded || state.modules.length === 0) { - // Load chiptune demo preset deserialize(CHIPTUNE_PRESET); } }, []);