Skip to content

fix: reconnect banner never cleared after SSE reconnect#129

Merged
joaomdsg merged 1 commit into
mainfrom
fix/reconnect-clear-on-patch
Jun 11, 2026
Merged

fix: reconnect banner never cleared after SSE reconnect#129
joaomdsg merged 1 commit into
mainfrom
fix/reconnect-clear-on-patch

Conversation

@joaomdsg

Copy link
Copy Markdown
Member

Second bug found by the in-browser verification campaign (and worse than the first).

The reconnect manager (#122/#126) cleared the "Reconnecting…" banner / reset data-via-connection to online only on datastar-fetch started/finished. But a long-lived SSE @get stream fires only retrying when it drops — no started/finished on a successful resume. So after a real reconnect the banner stayed stuck "Reconnecting…" and the attribute stuck "connecting" forever, even though patches were flowing again. (Verified live: killed the server, watched it reconnect — local re-bootstrapped to fresh state while the banner never cleared.)

Fix

Clear on incoming SSE patch events (datastar-patch-elements / datastar-patch-signals) — an arrived patch (the reconnect re-bootstrap, or via's 25s heartbeat) is the only reliable "stream alive again" signal for a streaming fetch.

Why it escaped the chromedp test

The browser test dispatched synthetic started/finished events, so it exercised a path that doesn't occur on a real reconnect. The test now dispatches a patch event and asserts the banner clears + connection returns to online (online→connecting→online→offline lifecycle).

Full ci-check.sh green; browser test passes locally.

The reconnect manager cleared the "Reconnecting…" banner (and reset
data-via-connection to "online") only on datastar-fetch 'started'/'finished'.
But a long-lived SSE @get stream fires 'retrying' when it drops and emits NO
'started'/'finished' when it successfully resumes — so after a real reconnect
the banner stayed stuck showing "Reconnecting…" and the connection attribute
stayed "connecting" forever, even though data was flowing again.

Clear on incoming SSE patches (datastar-patch-elements / datastar-patch-signals)
instead: an arrived patch — the reconnect re-bootstrap, or via's periodic
heartbeat — is the only reliable "stream is alive again" signal for a streaming
fetch. Found by killing the server under a live browser; the prior browser test
dispatched synthetic started/finished events, so it never exercised the real
reconnect path. The test now drives a patch event and asserts the banner clears.
@joaomdsg
joaomdsg merged commit a59a52b into main Jun 11, 2026
4 checks passed
@joaomdsg
joaomdsg deleted the fix/reconnect-clear-on-patch branch June 11, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant