Skip to content

fix(dashboard): keep a hidden remote pane's layout form instead of flashing the phone form - #34037

Merged
bolichen97 merged 1 commit into
mainfrom
fix/remote-pane-hidden-width
Nov 10, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/remote-pane-hidden-width

Conversation

@iamwhatever

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Switching to a remote crew tab shows its normal desktop layout at once, with no full-page side panel that then animates back.

Every switch to a remote crew tab first shows that crew's side panel filling the whole page. A morph animation then shrinks it back to the normal layout.

Why it matters

Anyone with a remote crew sees this flash on every tab switch. It looks broken and delays the moment the chat is usable.

Not a goal

  • Changing how inactive remote panes are hidden (display:none in InstancesViewport). Other gates rely on a hidden pane having no layout box, for example the terminal paste guard that drops a paste into a hidden shell.
  • Changing the phone/desktop breakpoint or the morph animation for real window resizes.

What changed (motivation → approach → change)

Moment Viewport the pane sees Form before Form after
Pane hidden 0 x 0 phone (side panel fills page) keeps the last form drawn
First loaded while hidden 0 x 0 phone desktop
Pane shown real width morphs phone → desktop swaps instantly, only if the form differs
Real resize across 768px real width morphs morphs (unchanged)

Root cause: an inactive remote pane is an iframe hidden with display:none. Such a frame reports a 0x0 viewport and matches (max-width: 767px), so useIsMobile switched the hidden pane to the phone form. When the tab was shown, the width jumped back, the pane got resize and the media-query change, and runLayoutFormChange played the phone-to-desktop view transition. That transition is the animation users saw.

The fix is in useIsMobile: a 0x0 viewport never decides the form. The pane keeps the form it last drew, or desktop if it never had a real size. A form change noticed on the first signal after a 0x0 viewport applies instantly, because nobody watched a resize.

Backwards compatibility

Compatible: only a document with a 0x0 viewport behaves differently, and no visible page has one.

Removes nothing: the phone form, the breakpoint and the resize morph all stay.

Tests

website/src/test/useIsMobile.test.ts adds three cases: a hidden pane keeps desktop and shows with no morph; a pane first loaded hidden starts on desktop and swaps instantly when shown narrow; a real resize across the breakpoint still morphs. With the useIsMobile.ts change reverted, the first two fail and the third passes.

Proof: not provable -- frontend test (prove.py runs Python only)

Manual verification

A Chromium probe (Playwright) measured the cause: a display:none iframe reports innerWidth 0 and matches the narrow query; once shown it fires resize and the query's change at width 1400. A visibility:hidden iframe keeps 1400 and fires neither. End-to-end check with a connected remote crew is still needed: switch away and back, and the pane should appear at once with no side-panel flash.

Screenshots / video

Not captured: reproducing needs a remote crew tab, and the isolated dev gateway cannot mint its own dashboard URL from an agent session. The rendered change is that the flash and its morph no longer play on a tab switch.

Related Issues

Closes #34029

Sibling sweep

Swept: git grep -n "max-width" -- website/src (live viewport-form readers outside the test tree)
Sibling: website/src/hooks/useKeyboardShortcuts.ts -- not affected -- read only at keypress, which needs a visible pane
Sibling: website/src/store/chatSlice.ts -- not affected -- a hidden pane only picks a smaller page size for older history

Pattern harvest

Not generalizable: the 0x0 viewport comes from one host choice, display:none warm iframes, and the form store is the one place that turned it into a layout change.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners November 9, 2026 18:16
@iamwhatever
iamwhatever requested a review from Zedmor November 9, 2026 18:16
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of ae8cf457e73fe9dd16cc698b64fa2cab1c898263 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] ae8cf45

False positive or not applicable? A repository writer can comment:
/ai-review override gpt ae8cf457e73fe9dd16cc698b64fa2cab1c898263 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of ae8cf457e73fe9dd16cc698b64fa2cab1c898263 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level concerns: the fix sits in the one place that turned a 0x0 hidden-iframe viewport into a form change, and the resize morph and the display:none hiding stay as they were.

Notes

  • The description says the end-to-end check with a connected remote crew is still needed. Run it before merge: the fix relies on Chromium updating innerWidth before the first resize or change fires on reveal, and the probe measured that but no test covers it.

[DESIGN-REVIEWED] ae8cf45

Description read

[DESCRIPTION-READ] 6fd71e9ca26e15eaebbd24885a91359bfa09ec676ff9ef68c797e79446e5de39

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of ae8cf457e73fe9dd16cc698b64fa2cab1c898263 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. The fix is in the hook that turned the hidden pane's 0x0 viewport into a form change, and the PR's Not-a-goal section explicitly leaves the display:none hiding alone.

What this change ships

Inventory (3 items) — 3 justified

Intent: switching to a remote crew tab should show its desktop layout at once, without a full-page side-panel flash. This is a FIX (Closes #34029, and the tests fail on base).

  1. A hidden remote pane keeps the layout it last drew instead of switching to the phone layout while hidden. — justified
  2. A pane first loaded while hidden starts on desktop. — justified
  3. A layout change noticed when a hidden pane is shown again swaps instantly, with no morph; real resizes still morph. — justified

[FIRST-PRINCIPLES-REVIEWED] ae8cf45

Description read

[DESCRIPTION-READ] 972af38424dd8a65718362c5874a04ac24164384f94880ef4057c00a912495f9

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of ae8cf457e73fe9dd16cc698b64fa2cab1c898263 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

No control, label or string is added or changed. The diff only stops a hidden pane from re-forming; the remaining instant swap happens while the pane is off-screen, and the description explains why.

Notes

  • The description says no one has yet checked this with a connected remote crew. Attaching a short tab-switch recording would show the side-panel flash is gone.

[UX-REVIEWED] ae8cf45

Description read

[DESCRIPTION-READ] 4af1cb7124df42f94b9cdbe2a4e227a15e2cab6ec7a9d38c4377303eb28e70d6

That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed ae8cf457e73fe9dd16cc698b64fa2cab1c898263 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] ae8cf45

Verdict parsed from the review's SHA-scoped output markers for commit ae8cf457e73fe9dd16cc698b64fa2cab1c898263.

False positive or not applicable? A repository writer can comment:
/ai-review override fable ae8cf457e73fe9dd16cc698b64fa2cab1c898263 false-positive: <reason, 20 to 500 characters>

@iamwhatever
iamwhatever force-pushed the fix/remote-pane-hidden-width branch from 3456ca2 to ad4a278 Compare November 9, 2026 21:56
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in website/src/hooks/useDebouncedValue.ts (same directory as website/src/hooks/useIsMobile.ts) since this head went green (79bff1f -> 5ed49b3); CI re-running.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in website/src/hooks/ (same directory as website/src/hooks/useIsMobile.ts) since this head went green (5ed49b3 -> b7b7b6c); CI re-running.

@iamwhatever
iamwhatever force-pushed the fix/remote-pane-hidden-width branch from ad4a278 to 1edd1c3 Compare November 10, 2026 18:05
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Backend Tests shards 4-7 on head 1edd1c3 fail in the Slack code-channel tests (refused vs set, InvalidStateError: Result is not set). They reproduce locally on this tree, whose only diff from main is two frontend files, so this is main's red: fix in flight in #34669 (also #34646, #34666). The AI review lanes and Dependency License Gate failed on the shared CI token's rate limit, not on a finding. This PR waits for the main fix, then rebases.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Rebased onto 4477b72, which carries the main-red fix #34646; the Slack code-channel tests pass locally on this head (1edd1c3). CI re-running.

@iamwhatever
iamwhatever force-pushed the fix/remote-pane-hidden-width branch from 1edd1c3 to ae8cf45 Compare November 10, 2026 19:02
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 10, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the whole diff, tests included, and the surrounding useIsMobile.ts on main.

  • A frame with a 0x0 viewport (a hidden remote pane) no longer decides the layout form. readLive keeps the committed form, or the touch-first form, or desktop, so a hidden pane does not redraw as a phone.
  • When the frame is shown again, onSignal sees the earlier no-viewport state and commits the new form at once, so there is no view transition. A real resize across the breakpoint still morphs.
  • committed, pending and the attach and detach paths behave as before for a normal viewport. The update callback also goes through readLive, so a pane hidden while the update runs keeps its form.
  • The three new tests cover hidden then shown, first load hidden, and a real resize. No regex added.

I did not run the tests locally.

@bolichen97
bolichen97 merged commit d72de22 into main Nov 10, 2026
97 checks passed
@bolichen97
bolichen97 deleted the fix/remote-pane-hidden-width branch November 10, 2026 20:13
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 10, 2026
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.

Remote crew tab flashes the phone layout, then morphs back, on every switch

2 participants