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.
This commit is contained in:
parent
1b72d1e4e4
commit
22c5c3d102
1 changed files with 7 additions and 5 deletions
|
|
@ -1169,7 +1169,7 @@
|
||||||
id: data.session_id,
|
id: data.session_id,
|
||||||
cwd: '',
|
cwd: '',
|
||||||
command: 'claude',
|
command: 'claude',
|
||||||
output: '',
|
output: data.html,
|
||||||
outputRenderedLength: 0,
|
outputRenderedLength: 0,
|
||||||
expanded: false,
|
expanded: false,
|
||||||
state: 'ready',
|
state: 'ready',
|
||||||
|
|
@ -1186,12 +1186,14 @@
|
||||||
git_files_json: null,
|
git_files_json: null,
|
||||||
};
|
};
|
||||||
state.sessions.set(data.session_id, session);
|
state.sessions.set(data.session_id, session);
|
||||||
|
// renderSessions() will render both the session and its output
|
||||||
renderSessions();
|
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) => {
|
es.addEventListener('output', (e) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue