From 22c5c3d1020bb3508ffb835150d24aa2a98a1c7b Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Sat, 31 Jan 2026 12:00:23 -0500 Subject: [PATCH] Fix dashboard race condition in initial_state handler When a new session's initial_state arrives, we now set the output before calling renderSessions() rather than after. This prevents renderSessionOutput() from being called before the DOM exists. --- public/index.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/public/index.html b/public/index.html index e3aa9e9..704d5f2 100644 --- a/public/index.html +++ b/public/index.html @@ -1169,7 +1169,7 @@ id: data.session_id, cwd: '', command: 'claude', - output: '', + output: data.html, outputRenderedLength: 0, expanded: false, state: 'ready', @@ -1186,12 +1186,14 @@ git_files_json: null, }; state.sessions.set(data.session_id, session); + // renderSessions() will render both the session and its output renderSessions(); + } else { + // Session already exists, update output and re-render it + session.output = data.html; + session.outputRenderedLength = 0; // Force re-render + renderSessionOutput(data.session_id); } - // Replace output with current terminal state - session.output = data.html; - session.outputRenderedLength = 0; // Force re-render - renderSessionOutput(data.session_id); }); es.addEventListener('output', (e) => {