fix(browser): size the display on firstFrame, not when connect resolves - #1196
Merged
Merged
Conversation
The viewer logged an unhandled rejection on every connect:
Uncaught (in promise) {code: 2, message: Display channel is not available.}
`requestDisplayLayout` was called from `connect().then()`, but the display
channel is not up at that point. It returns a PROMISE, so the try/catch
around it never saw the failure — it escaped as an unhandled rejection,
which is also why the comment claiming "not fatal" was never actually
exercised.
Moved into the `firstFrame` observer, which by definition fires once the
display channel is live, and the returned promise is now caught so a
declined layout stays a console note rather than an unhandled rejection.
The stream remains usable at whatever size the server chose.
Mutation-checked: calling it from `.then()` again fails the new assertion.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
What
The viewer logged an unhandled rejection on every connect:
requestDisplayLayoutwas called fromconnect().then(), but the display channel is not up at that point. It returns a promise, so thetry/catcharound it never saw the failure — it escaped as an unhandled rejection. That is also why the comment claiming "Not fatal: the stream renders at whatever the server chose" was never actually exercised: the code path it described didn't run.Moved into the
firstFrameobserver, which by definition fires once the display channel is live, and the returned promise is caught so a declined layout is a console note rather than an unhandled rejection.Context
Found while establishing whether the live view is now streaming at all. It appears to be: after #1190, #1192 and #1194 the console shows
Added connection 1 to connections, the display and input channels initialising, and no disconnect in 11 minutes. This rejection was the loudest remaining error and it turned out to be ours, and cosmetic.Two things remain open and are NOT addressed here:
authenticateper open. app-api is minting twice per viewer open (twoPOST …/browser/live-viewper session), and the second mint drives a second auth attempt that fails with code 10 while the first succeeds. Each mint is a live signed credential, so this is worth fixing on its own merits.Tests
Asserts the layout is requested only after
firstFrame, with the session's real viewport, and that a rejected request does not propagate.Mutation-checked: restoring the
.then()call fails the new assertion. Suite 878 pass,tsc --noEmitclean —tscagain caught typing jest's transpile-only run did not.🤖 Generated with Claude Code