fix(dashboard): show QR loading state immediately and keep polling until ready#97
Open
MrViSiOn wants to merge 2 commits into
Open
fix(dashboard): show QR loading state immediately and keep polling until ready#97MrViSiOn wants to merge 2 commits into
MrViSiOn wants to merge 2 commits into
Conversation
added 2 commits
May 19, 2026 13:16
…til ready When Chromium is still initializing, getQR returns an error before the QR is available. The previous code caught that error, set a global error banner, and stopped — leaving the user with no way to scan without manually retrying. This fix opens the QR modal in a loading state as soon as the user triggers Reconnect/Start, so the existing 5-second polling interval starts immediately. The interval now keeps running on transient errors (QR not ready yet) and only stops when the session itself reaches a terminal state (failed/disconnected) or when the QR is successfully scanned (status: ready).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a session is in
Failedordisconnectedstate and the user clicks Reconnect, Chromium takes a few seconds to initialize before the QR is available. During that window,GET /api/sessions/:id/qrreturns a 404/error. The previous code caught that error, displayed a global banner "QR code not available yet. Try again in a moment." and stopped — leaving the user unable to scan without clicking Reconnect again (and again).Root cause
handleShowQRonly calledsetQrDataon success. On error it fell through tosetError, which meantqrDatastayednulland the existing 5-second polling interval never started.Additionally,
fetchQR(called by the interval) clearedqrDataon any error, killing the interval even for transient "not ready yet" responses.Fix
Two small changes in
dashboard/src/pages/Sessions.tsx:handleShowQR— setsqrDatawith an emptyqrCodebefore the fetch, so the modal opens immediately showing a loading spinner and the polling interval starts right away. A transient fetch error no longer clears the modal.fetchQR— on error, checks the session status before clearingqrData. If the session is still initializing/connecting it keeps polling; it only stops when the session reaches a terminal state (failed/disconnected) or when the QR is successfully scanned (status: ready).Behaviour after fix
getQRNo new dependencies. Single file changed.