mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 02:29:33 +01:00
Merge #720: fix(log-viewer): stop reconnecting after a startup error
The floating log viewer reconnected every few seconds when its tail-file stream ended with a startup error (path refused, file missing, too large, stream limit, tail spawn failure). It now closes the EventSource on an `error` message that arrives before `connected`; an established stream keeps its reconnect. Squashed from #720 (johoja12). Maintainer edits while landing, as the review said: the onerror close is dropped (it stopped the browser's own retry after a transport failure, leaving the window on "Connecting"), the test's check for a button nothing renders is gone, and the stubbed stream sets `retry: 200` so a reconnect, if one came, shows within the shorter wait. Co-authored-by: Codeman maintainer <kay@stutz.science> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9518f4ecec
commit
687c75b490
3 files changed
+63
No files matched your search
@@ -6163,6 +6163,7 @@ Object.assign(CodemanApp.prototype, {
|
||||
CodemanBase.url(`/api/sessions/${sessionId}/tail-file?path=${encodeURIComponent(filePath)}&lines=50`)
|
||||
);
|
||||
|
||||
let connected = false;
|
||||
eventSource.onmessage = (e) => {
|
||||
const data = JSON.parse(e.data);
|
||||
const body = document.getElementById(`log-viewer-body-${windowId}`);
|
||||
@@ -6170,6 +6171,7 @@ Object.assign(CodemanApp.prototype, {
|
||||
|
||||
switch (data.type) {
|
||||
case 'connected':
|
||||
connected = true;
|
||||
body.innerHTML = '';
|
||||
break;
|
||||
case 'data':
|
||||
@@ -6189,6 +6191,7 @@ Object.assign(CodemanApp.prototype, {
|
||||
this.updateLogViewerStatus(windowId, 'disconnected', 'ended');
|
||||
break;
|
||||
case 'error':
|
||||
if (!connected) eventSource.close();
|
||||
body.innerHTML += `<div class="log-error">${escapeHtml(data.error)}</div>`;
|
||||
this.updateLogViewerStatus(windowId, 'error', 'error');
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user