fix(mobile): restore search composer on phone-width mode-home pages#456
Conversation
The hero-composer media query was raised to (min-width: 640px), but the inline composer fallback was suppressed whenever a desktop-home slot id was present. Below 640px the portal never mounted and the fallback was disabled, so the search composer disappeared entirely on phones. Track the hero media-query match independently of portal mount state and render the inline composer whenever the hero composer is neither active nor pending, guaranteeing the composer is always present at some width. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe desktop home composer now uses a 640px media-query breakpoint, tracks media-query matches separately from portal activation, resets that state during lifecycle changes, and uses it to control inline fallback rendering. ChangesDesktop home composer
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 11✅ Passed checks (11 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/clinical-dashboard/master-search-header.tsx (1)
716-742: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winFallback stays suppressed when the slot never mounts
setDesktopHomeComposerMediaMatches(mediaQuery.matches)is set from the media query alone, so a missing or misnameddesktopHomeComposerSlotIdleaves that flagtrueeven after retries stop. Because the render gate hides the inline composer wheneverdesktopHomeComposerSlotId && desktopHomeComposerMediaMatchesis true, the composer can disappear on tablet/desktop with no fallback. Tie the suppression to the portal actually mounting, or clear the media-match flag when retries are exhausted.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/clinical-dashboard/master-search-header.tsx` around lines 716 - 742, Update syncTarget to keep desktopHomeComposerMediaMatches synchronized with successful portal mounting: set it true only when the matching slot exists and the host is attached, and set it false when the slot is missing, especially when portalRetryCount reaches the retry limit. Preserve the existing retry behavior while ensuring the render gate can fall back to the inline composer after retries are exhausted.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/components/clinical-dashboard/master-search-header.tsx`:
- Around line 716-742: Update syncTarget to keep desktopHomeComposerMediaMatches
synchronized with successful portal mounting: set it true only when the matching
slot exists and the host is attached, and set it false when the slot is missing,
especially when portalRetryCount reaches the retry limit. Preserve the existing
retry behavior while ensuring the render gate can fall back to the inline
composer after retries are exhausted.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 038cb7ed-eca4-4e0d-88ef-aa6acb3b02e6
📒 Files selected for processing (1)
src/components/clinical-dashboard/master-search-header.tsx
… let it vanish (#470) * fix(mobile): keep mode-home composer hero-centred on phones and never let it vanish Follow-up to #456, which fixed the phone-width composer vanish by raising the mode-home hero query to 640px — moving the phone composer into the bottom dock and regressing the hero-centred landing design that four advisory UI tests encode (confirmed A/B against pre-merge main). - Restore modeHomeComposerMediaQuery to (min-width: 0px) so mode-home shells portal the composer into the hero at every width. - Key the inline fallback on portal outcome instead of the media match: while a slot id is present the inline composer stays suppressed only until the portal mounts or the slot-retry budget exhausts, so the search can never vanish at any width even when the slot never appears. - Add a @critical composer-presence test (phone + desktop, dashboard and standalone shells) so this bug class blocks merges via the required Critical UI smoke gate instead of only failing the advisory suite. - Record the PR #456 review in docs/branch-review-ledger.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * style: realign branch-review-ledger table after merge Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Problem
On mode-home pages (Answer and the other mode landing screens) the search composer disappeared entirely at phone widths — the hero sat at the top of an otherwise empty screen.
Cause
The hero-composer media query was raised to
(min-width: 640px), but the inline composer fallback was suppressed whenever a desktop-home slot id was present. Below 640px the portal never mounted and the fallback was disabled, so no composer rendered anywhere on the page.Fix
Track the hero media-query match (
desktopHomeComposerMediaMatches) independently of portal mount state, and render the inline composer whenever the hero composer is neither active nor pending. This keeps the author's 640px hero-placement intent on tablet/desktop while guaranteeing the composer is always present at some width — it can no longer silently vanish.Verification
npm run typecheck— clean (exit 0)npm run test:e2e:chromium(real Chromium) — thedashboard loads without page overflowtests at 320 / 375 / 414px (all < 640px, the dead zone) andanonymous mobile user can searchat 390px assert the composer input is visible/enabled on mode-home; all pass. Tablet/desktop (667–1280px) still portal the composer into the hero.🤖 Generated with Claude Code