fix: single Synth button opens instrument modal, fix init race condition

- Remove small Synth button (already done earlier)
- Large Synth button now calls openInstrumentSelector (instrument modal)
- Fix _initPromise stale cache: reset to null when init fails
- Module not loaded yet → retries on next select instead of stuck
This commit is contained in:
2026-07-27 10:54:58 +07:00
parent cf61b8431d
commit 5c47b68a9d
3 changed files with 8 additions and 3 deletions
+1 -1
View File
@@ -15888,7 +15888,7 @@ const App = () => {
})), " FX: ", /*#__PURE__*/React.createElement("span", {
className: "text-zinc-500 font-normal"
}, track.fxType || "None")), /*#__PURE__*/React.createElement("button", {
onClick: (e) => { e.stopPropagation(); const btn = e.currentTarget; setInstrumentDropdownTrackId(prev => prev === track.id ? null : track.id); setInstrumentDropdownBtnRect(btn.getBoundingClientRect()); setInstrumentSearchQuery(''); },
onClick: (e) => { e.stopPropagation(); openInstrumentSelector(track.id); },
className: "px-2.5 py-1 bg-zinc-800 hover:bg-zinc-700 text-amber-400 border border-amber-800 rounded text-xs font-bold flex items-center gap-1 max-w-[120px]"
}, /*#__PURE__*/React.createElement("span", {
className: "inline-flex items-center shrink-0"
File diff suppressed because one or more lines are too long
+6 -1
View File
@@ -44,7 +44,11 @@
if (_initialized && _synthInstance) return;
if (_initPromise) return _initPromise;
_initPromise = (async () => {
if (!window.SpessaSynthClass || !window.__SpessaSynthCDN) return;
if (!window.SpessaSynthClass || !window.__SpessaSynthCDN) {
console.warn("[SonicSF] SpessaSynth CDN not available. Retrying on next select.");
_initPromise = null;
return;
}
try {
if (audioContext.state === 'suspended') await audioContext.resume();
const procUrl = window.__SpessaSynthCDN + "spessasynth_processor.min.js";
@@ -55,6 +59,7 @@
_initialized = true;
} catch (e) {
console.warn("[SonicSF] SpessaSynth init failed:", e);
_initPromise = null;
}
})();
return _initPromise;