From beacb0210191bf05ffaf494f9eb2e054033cb5ef Mon Sep 17 00:00:00 2001 From: Jason Hoku Date: Sun, 5 Apr 2026 10:32:45 -0700 Subject: [PATCH] fix: fullscreen toggle loads correct session instead of default When toggling fullscreen, the iframe reload was reading the session name from the node's widget (default "my_session") instead of the session the user had actually selected in the Dashboard picker. Now the Dashboard sends its current session name in the fullscreen postMessage, and the handler prefers that over the widget default. Co-Authored-By: Claude Opus 4.6 (1M context) --- resources/logic_utils.js | 4 +++- web/dashboard.js | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/resources/logic_utils.js b/resources/logic_utils.js index 922939a..e9ac521 100644 --- a/resources/logic_utils.js +++ b/resources/logic_utils.js @@ -5,7 +5,9 @@ */ function toggleFullscreen() { - window.parent.postMessage({ type: 'toggle_fullscreen', node_id: TARGET_NODE_ID }, '*'); + // Send current session name so fullscreen reload uses the right session + var currentSession = document.getElementById('session-input')?.value || ''; + window.parent.postMessage({ type: 'toggle_fullscreen', node_id: TARGET_NODE_ID, session_name: currentSession }, '*'); } diff --git a/web/dashboard.js b/web/dashboard.js index 0345cc5..252a2a5 100644 --- a/web/dashboard.js +++ b/web/dashboard.js @@ -180,9 +180,11 @@ app.registerExtension({ el.addEventListener('load', () => { console.log('[UltimateGrid] Iframe reloaded after fullscreen toggle, restoring session...'); - // Get the session name from the node's widget - const sessionWidget = graphNode.widgets?.find(w => w.name === "session_name"); - const sessionName = sessionWidget ? sessionWidget.value : null; + // Get the session name — prefer the one from the iframe (user may have + // loaded a different session via the picker), fall back to node widget + const sessionName = event.data.session_name + || graphNode.widgets?.find(w => w.name === "session_name")?.value + || null; if (sessionName && graphNode.forceLoadSession) { graphNode.forceLoadSession(sessionName);