refactor(app): extract pawwork routing actions + deep-links from layout.tsx - #1061
Conversation
|
Warning Review limit reached
More reviews will be available in 2 minutes and 20 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✨ 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 |
There was a problem hiding this comment.
Suggested priority: P2 (includes user-path files (packages/app/src/pages/layout.tsx, packages/app/src/pages/layout/pawwork-routing-actions.test.ts, packages/app/src/pages/layout/pawwork-routing-actions.ts)).
P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.
There was a problem hiding this comment.
Code Review
This pull request refactors the routing and deep-link handling logic from the main layout component into a new helper function createPawworkRoutingActions, accompanied by a new test suite. A review comment points out a missing dispose() call in one of the tests, which could lead to memory leaks.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…ering, rAF scroll, original slug)
|
Re gemini thread on pawwork-routing-actions.test.ts:161 — false positive. Every |
Summary
Pure extraction (layout governance slice 4, refs #1056) of the pawwork routing actions and deep-link handling out of
packages/app/src/pages/layout.tsxintopackages/app/src/pages/layout/pawwork-routing-actions.ts. Design reviewed via /codex consult before implementation.What moved (verbatim, no behavior change)
syncSessionRoute,navigateToProject,navigateToSession,openPawworkHome,openProjecthandleDeepLinks+ theonMountthat drains pending deep-links and registers the windowdeepLinkEventlistenerExposed as
createPawworkRoutingActions(input). The 5 routing actions are destructured back into layout.tsx with identical names; every call site (startup autoselectcreateResource, keyboard-navnavigateSessionByOffset/navigateSessionByUnseen,chooseProject, active-route effect, command/sidebar config) is byte-unchanged.Scope boundary (per /codex design consult)
projectRoot/activeProjectRoot/shellNavigationstay in layout.tsx and are injected as input.shellNavigationalso serves settings (openSettings) and would form a cycle withprojectRootif moved; keeping them in layout is the cleanest boundary and matches "layout as composition root".navigateSessionByOffset/navigateSessionByUnseen/navigateProjectByOffset) stays in layout — it coordinates slice 1/2/3 controllers.onMount+ deep-link listener live in the controller (precedent:layout-update-polling.ts,layout-sdk-event-effects.tsregister lifecycle internally);makeEventListenercleanup stays under the Layout owner.openProject(dir,false)+ navigate to the original slug (NOTopenPawworkHome, which would resolve a different project root);syncSessionRoutekeeps returningroot(consumed byactiveRoute.sessionProjectdedupe);navigateToSessionkeeps unhide-then-openSession order. The innerrequestAnimationFrame/untrackpositions are preserved verbatim.Touched files
packages/app/src/pages/layout.tsx(+22 / -90; 1598->1530 lines; removed 5 fn defs + deep-link block + 6 now-unused imports:openProjectRoute, the 4 deep-links helpers,pawworkSessionRouteUnhideKeys,setSessionHandoff)packages/app/src/pages/layout/pawwork-routing-actions.ts(new, ~130 lines)packages/app/src/pages/layout/pawwork-routing-actions.test.ts(new, 7 focused tests)Verification
bun turbo typecheck: 8/8 passcd packages/app && bun test src/pages/layout: 165 pass / 0 fail (7 new routing tests: hidden-project unhide on navigateToSession/openPawworkHome, syncSessionRoute return/markViewed/expand, deep-link new-session uses openProject+slug-navigate not openPawworkHome, deep-link open-project routes through navigateToProject)e2e-artifactsfor rendered routing/deep-link paths.Risk
Low. TDZ note:
openProjectis captured by the startup-autoselectcreateResourceclosure; the fetcherawaits ready/layout.ready before calling it, so the destructured const is initialized by the time it runs.layout.tsxis also touched by open PR #1053 (automation) in non-overlapping regions; #1053 rebases after this merges (per repo owner).Refs #1056, follow-up to #875.