fix(gui): persist embedded VST GUI state across panel close/reopen

Close/reopen of Mastering panel or FX Rack unmounted the modal, losing
masterGuiOpen/fxGuiOpen state. The native bridge window stayed alive but
hidden, so reopening the panel showed no GUI and no /show was re-posted —
user could not interact with the VST GUI. Persist the embed state at module
scope so remount re-anchors and re-shows the window automatically.
This commit is contained in:
2026-08-19 10:34:52 +07:00
parent e5ce9ca90a
commit 1dfba14114
2 changed files with 20 additions and 8 deletions
+10 -2
View File
@@ -12065,6 +12065,9 @@ const ExportModal = ({ open, onClose, exportSettings, setExportSettings, isExpor
);
};
// GUI embed state survives FXRackModal unmount so the native window
// re-shows automatically when the rack is reopened (close/reopen bug).
let _persistFxGuiOpen = null;
const FXRackModal = ({ track, onUpdateTrack, onClose }) => {
const [activeType, setActiveType] = React.useState('eq');
const [addModuleOpen, setAddModuleOpen] = React.useState(false);
@@ -12100,7 +12103,8 @@ const FXRackModal = ({ track, onUpdateTrack, onClose }) => {
const vstChain = (track.vstFxChain || []);
const setVstChain = (next) => { if (onUpdateTrack) onUpdateTrack(track.id, { vstFxChain: next, vstFxBypass: vstBypass }); };
// Embedded VST GUI state (PLAN_MASTERBUS_VST_GUI_EMBED.md Phase 3)
const [fxGuiOpen, setFxGuiOpen] = React.useState(null); // { path, url } | null
const [fxGuiOpen, setFxGuiOpenState] = React.useState(_persistFxGuiOpen); // { path, url } | null
const setFxGuiOpen = (v) => { _persistFxGuiOpen = v; setFxGuiOpenState(v); };
const fxGuiOpenRef = React.useRef(null);
fxGuiOpenRef.current = fxGuiOpen;
const closeFxGui = () => {
@@ -12624,6 +12628,9 @@ const addVst = (path) => { const fx = (fxList || []).find(f => f.path === path);
// ──────────────────────────────────────────────
// MASTERING MODAL COMPONENT (from md/45_MASTERING_MODULE.md)
// ──────────────────────────────────────────────
// GUI embed state survives MasteringModal unmount so the native window
// re-shows automatically when the panel is reopened (close/reopen bug).
let _persistMasterGuiOpen = null;
const MasteringModal = ({ isOpen, onClose, masteringSettings, setMasteringSettings }) => {
const ozState = masteringSettings;
const setOzState = setMasteringSettings;
@@ -12639,7 +12646,8 @@ const MasteringModal = ({ isOpen, onClose, masteringSettings, setMasteringSettin
// ── VST FX masterbus (native_bridge --render-fx, áp dụng khi Export/Offline render) ──
const masterVstChain = (ozState.vstFxChain || []);
// Embedded VST GUI state (PLAN_MASTERBUS_VST_GUI_EMBED.md Phase 2)
const [masterGuiOpen, setMasterGuiOpen] = React.useState(null); // { path, url } | null
const [masterGuiOpen, setMasterGuiOpenState] = React.useState(_persistMasterGuiOpen); // { path, url } | null
const setMasterGuiOpen = (v) => { _persistMasterGuiOpen = v; setMasterGuiOpenState(v); };
const [activeMasterVstPath, setActiveMasterVstPath] = React.useState(null);
const masterGuiOpenRef = React.useRef(null);
masterGuiOpenRef.current = masterGuiOpen;
File diff suppressed because one or more lines are too long