fix: stop choppy screen resize when switching modes#1248
Conversation
Mode switches animated phone composer reserve because searchMode updated before the pathname landed, briefly leaving isStandaloneModeHome false and running the 200ms padding transition. Detect mode homes from pathname only, navigate without optimistic mode state, and limit padding transitions to scroll-hide. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
After the reserve-flip fix, related choppiness remained from eager crossModeSearch chrome updates, inherited phone scroll/hide across mode homes, a hero-portal null gap while slots rebound, a taller mode-home loading skeleton, and services/forms contentAlign jumping after registry load. Navigate out of the dashboard without rewriting chrome, reset scroll-hide on pathname change, keep the default composer until the portal attaches, align the skeleton to the shell header token, and keep loading homes top-aligned on phone. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Reset bottom-composer hidden state during render on pathname change instead of setState-in-effect, and drop the unused hero-portal fallback flag now that the default composer stays mounted until the host attaches. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Append review of mode/page loading and navigation architecture at HEAD 0ef62ff: P1 shell bundle + hydration blanking; residual remount/tools dual. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Parallel loading review found hard-load blanking from ClientHydrationBoundary, mismatched/missing mode-home loading skeletons, forms catalog in the client chunk, ClinicalDashboard static weight on namespaced routes, sidebar column animation on remount, forms query remounts, and document viewer remounts on page flips. Paint RSC children immediately, align ModeHomeRouteLoading, wire mode-home loading.tsx files, server-pass the default form slug, dynamic-import ClinicalDashboard, gate sidebar transitions after mount, and stop unnecessary remount keys. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Keeps ClinicalDashboard inside the maintainability budget after the loading-performance pass, and shares the remount-safe sidebar transition gate with GlobalSearchShell. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Resolve chrome/scroll conflicts by keeping branch mode-switch lag fixes (gated padding transitions, dynamic ClinicalDashboard, portal keep-alive, pathname scroll/hide reset) while adopting main's cross-breakpoint scroll-hide architecture, lazy sidebar dialogs, and settings-guide flow. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…h-lag-22f6 Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
After merging main's cross-breakpoint scroll-hide wiring, update static contracts for resetKey=pathname, and keep phone padding transitions gated to scroll-hide only so mode switches still snap. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
|
Warning Review limit reached
Next review available in: 3 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (32)
📝 WalkthroughWalkthroughThe changes stabilize mode switching by centralizing route ownership, resetting scroll and shell state on pathname changes, standardizing mode-home loading UI, delaying composer portal handoff, gating layout transitions, and preventing unnecessary component remounts. Tests and documentation record these contracts. ChangesMode-switch stabilization
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant GlobalSearchShell
participant Router
participant ModeHomeRouteLoading
participant ClinicalDashboard
User->>GlobalSearchShell: Select a search mode
GlobalSearchShell->>Router: Push mode-specific href
Router->>ModeHomeRouteLoading: Render route loading fallback
Router->>ClinicalDashboard: Dynamically render dashboard-owned content
GlobalSearchShell->>GlobalSearchShell: Reset pathname-bound scroll and chrome state
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cff2d314a9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. After fixing or dispositioning a thread, reply in that thread with as the first line, followed by a concise summary; that marker authorizes the workflow to close that exact thread. If human input or new authorization is required, do not use the marker and leave the thread open with the blocker. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation. |
Summary
Testing
|
…n blanking Resolve conflicts from desktop page-slot search (#1252) and phone chrome work by taking main's page composer slot + portal rename, while keeping this branch's host-attached keep-alive (no suppress-on-slotId) and omitting ClientHydrationBoundary around mode-home children. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…BigSimmo/Database into cursor/fix-mode-switch-lag-22f6 Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 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.
Inline comments:
In `@src/components/clinical-dashboard/master-search-header.tsx`:
- Around line 2002-2005: The default hero composer in
renderSearchComposer("default") must remain visible on desktop until both
desktopComposerPortalActive and desktopComposerPortalHost are present; adjust
the sm:hidden behavior accordingly while preserving mobile behavior. Update
tests/search-route-ownership.test.ts lines 111-121 to cover the pre-host desktop
state and verify the fallback is not hidden before portal attachment.
In `@src/components/forms/forms-home-page.tsx`:
- Around line 31-55: Update buildTaskCards so the “Readiness checks” action is
omitted when defaultFormSlug is null, rather than generating the /forms/
fallback URL; preserve the existing card and href when a default slug is
available.
In `@src/lib/private-search-scope.ts`:
- Around line 75-80: Update removePrivateScopeRefFromUrl to include hash in the
Location pick and preserve location.hash when constructing the URL passed to
history.replaceState, while keeping the existing pathname and query-parameter
removal behavior unchanged.
In `@src/lib/search-route-ownership.ts`:
- Around line 42-45: Classify document-search URLs as dashboard-owned by
updating isDashboardModeHref to recognize /documents/search with or without
query parameters. In src/lib/search-route-ownership.ts lines 42-45, make the
predicate change; the ClinicalDashboard.tsx paths at lines 2321-2334 and
2629-2637 require no direct changes because the corrected predicate preserves
their internal transitions. Add positive /documents/search coverage in
tests/search-route-ownership.test.ts lines 73-79.
In `@tests/forms-client-boundary.test.ts`:
- Around line 9-11: Update collectSourceFiles() to scan all supported source
extensions, including .js and .jsx alongside .ts and .tsx. Extend module
resolution for both relative imports and `@/` aliases so matching candidates
across every supported extension are included, ensuring JavaScript entrypoints
and transitive intermediates are captured.
🪄 Autofix (Beta)
❌ Autofix failed (check again to retry)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 1d4e2b0d-16c8-4e25-ac60-649dc78ab4ff
📒 Files selected for processing (36)
docs/branch-review-ledger.mddocs/search-chrome-behaviour.mdscripts/check-maintainability-budgets.mjssrc/app/(search-app)/differentials/loading.tsxsrc/app/(search-app)/documents/[id]/page.tsxsrc/app/(search-app)/dsm/loading.tsxsrc/app/(search-app)/factsheets/loading.tsxsrc/app/(search-app)/favourites/loading.tsxsrc/app/(search-app)/forms/loading.tsxsrc/app/(search-app)/forms/page.tsxsrc/app/(search-app)/formulation/loading.tsxsrc/app/(search-app)/page.tsxsrc/app/(search-app)/specifiers/loading.tsxsrc/app/(search-app)/therapy-compass/loading.tsxsrc/app/globals.csssrc/components/ClinicalDashboard.tsxsrc/components/clinical-dashboard/global-search-shell.tsxsrc/components/clinical-dashboard/master-search-header.tsxsrc/components/clinical-dashboard/shared-search-app-shell.tsxsrc/components/clinical-dashboard/use-hide-on-scroll.tssrc/components/clinical-dashboard/use-sidebar-column-transition.tssrc/components/forms/forms-home-page.tsxsrc/components/forms/forms-search-results-page.tsxsrc/components/mode-home-page-skeleton.tsxsrc/components/services/services-home-page.tsxsrc/lib/private-search-scope.tssrc/lib/search-route-ownership.tstests/clinical-dashboard-merge-artifacts.test.tstests/document-detail-performance.test.tstests/forms-client-boundary.test.tstests/header-scroll-hide-contract.test.tstests/mode-home-loading-contract.test.tstests/mode-home-main-align.test.tstests/search-route-ownership.test.tstests/therapy-compass-mode-wiring.test.tstests/ui-phone-scroll.spec.ts
CI triageCI failed on this PR. Automated classification of the 2 failed job(s):
Compared with main CI run #5867 (success). Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger. |
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. The branch was updated while autofix was in progress. Please try again. |
Gate desktop composer portal adoption until page-owned slots mark themselves ready after hydration, so hard-loads no longer inject a display:contents host into still-unhydrated RSC HTML (React #418). Update phone-scroll expectations for scroll-hide-only reserve transitions. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Treat /documents/search as in-shell for cross-mode sync, keep a short-lived reserve-transition marker through hide and reveal, omit readiness cards without a default slug, and preserve URL hashes when clearing private scope refs.
… into cursor/fix-mode-switch-lag-22f6
Nesting route children inside the shell's useSearchParams Suspense left a hidden Next streaming S: clone of forms/favourites/presentation roots under CI load. Gate always-standalone paths off that boundary and bridge params beside the shell body so mode-home RSC paint stays. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e963e489c3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Pull PDF viewer mode helpers and document chrome scroll wiring into focused modules, and isolate the dashboard desktop result composer slot, so maintainability no-growth budgets pass after the reserve-transition and portal ready-gate work. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Use useSyncExternalStore for the client-only gate and call the param callback from layout effect deps instead of updating a ref during render. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found. |
…h-lag-22f6 Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Drop the settled-bottom 0.24s reserve check (transition is short-lived on data-reserve-transitioning), and scope differential presentation lookups to the live shell scrollport so hidden Next streaming clones cannot fail strict mode under CI load. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
… into cursor/fix-mode-switch-lag-22f6 # Conflicts: # tests/ui-phone-scroll.spec.ts Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Summary
Stops the choppy phone “screen resize” when switching modes, and closes related mode-home loading/layout thrash:
searchModegate)pathname(resetKey+scrollTop)ClientHydrationBoundarydata-composer-slot-ready) so hard-loads do not trip React Fix differential badge design for mobile search results #418{children}outside the shelluseSearchParams()Suspense so Next streaming cannot leave a hidden duplicate page-rootdata-testidClinicalDashboardso namespaced modes do not parse it eagerlyloading.tsxskeletons and related remount/transition gatesMerged latest
mainincluding#1252desktop page-slot search and#1246/#1256phone chrome work.Conflict resolutions vs
main(judgment)master-search-header: took main’s page/hero portal rename + desktop page slots; kept this branch’s host-attached keep-alive (did not suppress the default composer on slotId/fallback while waiting).global-search-shell: took main’sdesktop-page-search-composer-slot; kept this branch’s noClientHydrationBoundaryaround mode children (LCP/blanking), with ready-gated portal attach + standalone Suspense bypass instead.Supersedes closed PR #1187.
RAG impact: no retrieval behaviour change — UI chrome, routing ownership, composer portal attach timing, and shell Suspense boundaries only.
Verification
npm run verify:cheap— green earlier on tip; focused contracts re-run after portal/Suspense/budget extractionsui-toolsspecsnpm run verify:pr-localensure/verify:uiin this pass; Production UI CI covers the full Playwright gateRisk and rollout
Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy)Notes
wip-after-main-merge-registry-cacheSummary by CodeRabbit
New Features
Bug Fixes
Tests