fix(ws): delay reconnect banner so page nav does not flash it (LC-318) #343
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/lc-318-reconnect-banner-grace"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Delay the WebSocket connection-status banner so a normal page navigation no longer flashes "Connection lost. Reconnecting...".
Why
The banner state machine in
layout.htmlpainted the reconnecting banner the instanthtmx:wsClosefired. A boosted page navigation swaps thews-connectelement, which briefly closes and reopens the socket, so the banner flashed for about a second on every page move (LC-318), including bouncing between the same two pages.Fix
enterReconnectingnow schedules the banner paint behind aGRACE_MS(3s) timer instead of painting immediately. If the socket reopens within the window (the navigation case),enterConnectedclears the pending timer silently: no banner, no green "Connected" flash, and no soft-refresh (the freshly navigated page already has current content). Only an outage that outlasts the grace paints "Reconnecting" and starts the existing 5-minute escalation to "Still trying to reconnect"; a real reconnect after the banner was shown still flashes "Connected" and soft-refreshes#mainto recover missed content.Test
just testandjust test-saasgreen;cargo checkclean (Askama compiles the template).routes_reconnect.rsstill passes (banner element + baselinedata-state="hidden"+#mainwrapper unchanged). Manual: navigate between pages repeatedly (no flash); kill the server (banner appears after ~3s, escalates, then flashes "Connected" + refreshes on recovery).#LC-318