Repository navigation
fix(mobile): mount host before opening tasks - #11853
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdded typed mobile task route builders with optional provider support. Added pending navigation intents and mounted-host route resolution. Added 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4f5123e8-5d43-432b-bc19-93c23b9f8230
📥 Commits
Reviewing files that changed from the base of the PR and between e79304c and 612111fd4b751c536a2168769aef31853384d752.
📒 Files selected for processing (3)
mobile/app/index.tsxmobile/src/tasks/mobile-task-navigation.test.tsmobile/src/tasks/mobile-task-navigation.ts
Greptile SummaryThis PR fixes a cold-start navigation bug where opening Tasks from the Home screen would land on a blank Host screen. The root cause was a direct
Confidence Score: 5/5The change is safe to merge. The two-step navigation pattern is correctly implemented with proper cleanup, and the unit tests cover the key edge cases. The core fix — waiting for the host stack to commit before dispatching the REPLACE action — is sound. The listener is subscribed before the push, disposed before dispatching, and guarded by the active flag throughout. Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| mobile/src/tasks/mobile-task-navigation.ts | New module implementing the two-step host-then-tasks navigation coordination. State listener, host-stack detection, and cleanup logic are all correctly ordered and guarded. |
| mobile/src/tasks/use-open-mobile-tasks.ts | React hook wrapping coordinateMobileTasksNavigation with a ref for pending state; cleanup effect correctly cancels on unmount, and useCallback deps are stable Expo Router references. |
| mobile/src/tasks/mobile-task-navigation.test.ts | Six well-scoped unit tests covering happy path, provider preservation, cancellation, deduplication, early-navigation-exit cleanup, and synchronous push errors. No test isolation issues in the current revision. |
| mobile/app/index.tsx | HomeScreen now delegates task navigation to useOpenMobileTasks, removing the direct router.push path that bypassed host-stack initialization. |
Reviews (8): Last reviewed commit: "fix(mobile): await delayed host stack se..." | Re-trigger Greptile
612111f to
4a7e0d0
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
mobile/src/tasks/mobile-task-navigation.test.ts (1)
22-27: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover the unsupported provider fallback.
mobileTasksRouteFromHostActionconverts an unsupportedtaskSourceinto a provider-less Tasks route. Add an assertion for this branch.Proposed test
expect(mobileTasksRouteFromHostAction('host-1', 'newWorktree', 'github')).toBeNull() expect(mobileTasksRouteFromHostAction(undefined, 'tasks', 'github')).toBeNull() + expect(mobileTasksRouteFromHostAction('host/1', 'tasks', 'unsupported')).toBe( + '/h/host%2F1/tasks' + )mobile/src/tasks/MobileTaskHostRoute.test.ts (1)
41-43: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover the wide-layout fallback.
The current test only covers
isWideLayout: false. Add a test that setsmocks.isWideLayouttotrueand expectsWorkspaceDetailPlaceholder.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 54b1625c-ece4-4d54-8104-210406478176
📒 Files selected for processing (5)
mobile/app/h/[hostId]/index.tsxmobile/src/tasks/MobileTaskHostRoute.test.tsmobile/src/tasks/MobileTaskHostRoute.tsxmobile/src/tasks/mobile-task-navigation.test.tsmobile/src/tasks/mobile-task-navigation.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
mobile/src/tasks/MobileTaskHostRoute.test.ts (1)
2-2: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueReplace the deprecated renderer in new tests.
React 19.2 deprecates
react-test-renderer. Use the repository-supported Testing Library integration for this new route coverage. Confirm the supported native test utility before migration.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 3cc37d05-f86e-4892-bc50-b91f2ff0ea92
📒 Files selected for processing (4)
mobile/src/tasks/MobileTaskHostRoute.test.tsmobile/src/tasks/MobileTaskHostRoute.tsxmobile/src/tasks/mobile-task-navigation.test.tsmobile/src/tasks/mobile-task-navigation.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- mobile/src/tasks/MobileTaskHostRoute.tsx
|
QA evidence for
|
Tapping Resume on Home landed on a blank host screen instead of the session. A cold push straight into the nested /h/[hostId] navigator resolves to the host index route without the dynamic id, so HostProtocolGate mounts with hostId undefined and never connects. Home already worked around this for the host editor (stablyai#11635) and Tasks (stablyai#11853) by mounting /h/[hostId] first and replacing it once the stack is committed. Extract that mechanism into host-stack-navigation so Resume uses the same transition instead of a direct push. The previous Resume fix (stablyai#11876) swapped the manual href for a typed dynamic href, but expo-router's encodeParam already applies encodeURIComponent to dynamic segments, so it resolved to the same URL the manual string produced and left the cold-navigator path unchanged. Claude-Session: https://claude.ai/code/session_01RMoaxp7MLg2ydP28KFLX7B
…12001) * fix(mobile): open the Resume workspace through a mounted host stack Tapping Resume on Home landed on a blank host screen instead of the session. A cold push straight into the nested /h/[hostId] navigator resolves to the host index route without the dynamic id, so HostProtocolGate mounts with hostId undefined and never connects. Home already worked around this for the host editor (#11635) and Tasks (#11853) by mounting /h/[hostId] first and replacing it once the stack is committed. Extract that mechanism into host-stack-navigation so Resume uses the same transition instead of a direct push. The previous Resume fix (#11876) swapped the manual href for a typed dynamic href, but expo-router's encodeParam already applies encodeURIComponent to dynamic segments, so it resolved to the same URL the manual string produced and left the cold-navigator path unchanged. Claude-Session: https://claude.ai/code/session_01RMoaxp7MLg2ydP28KFLX7B * fix(mobile): harden the host-stack transition after bot review - match a host route committed as the encoded segment it was pushed as, so an id containing `/`, `#`, or `%` still triggers the REPLACE - share one pending transition across the Home entry points; per-hook refs let a Tasks tap and a Resume tap arm two pushes that could not cancel each other - assert the source markers before slicing in the Resume wiring test Claude-Session: https://claude.ai/code/session_01RMoaxp7MLg2ydP28KFLX7B * test(mobile): lock the host-stack transition state machine Assert the replace waits for the host mount (zero dispatches before it, exactly one after), and cover cancel/retarget — the paths the shared pending transition relies on. * test(mobile): model listener removal in the navigation harness A no-op unsubscribe let setState keep calling a canceled listener, so the teardown assertions only exercised the active guard. Dropping the unsubscribe call from dispose now fails the suite. --------- Co-authored-by: kaynan <[email protected]>
…tablyai#12001) * fix(mobile): open the Resume workspace through a mounted host stack Tapping Resume on Home landed on a blank host screen instead of the session. A cold push straight into the nested /h/[hostId] navigator resolves to the host index route without the dynamic id, so HostProtocolGate mounts with hostId undefined and never connects. Home already worked around this for the host editor (stablyai#11635) and Tasks (stablyai#11853) by mounting /h/[hostId] first and replacing it once the stack is committed. Extract that mechanism into host-stack-navigation so Resume uses the same transition instead of a direct push. The previous Resume fix (stablyai#11876) swapped the manual href for a typed dynamic href, but expo-router's encodeParam already applies encodeURIComponent to dynamic segments, so it resolved to the same URL the manual string produced and left the cold-navigator path unchanged. Claude-Session: https://claude.ai/code/session_01RMoaxp7MLg2ydP28KFLX7B * fix(mobile): harden the host-stack transition after bot review - match a host route committed as the encoded segment it was pushed as, so an id containing `/`, `#`, or `%` still triggers the REPLACE - share one pending transition across the Home entry points; per-hook refs let a Tasks tap and a Resume tap arm two pushes that could not cancel each other - assert the source markers before slicing in the Resume wiring test Claude-Session: https://claude.ai/code/session_01RMoaxp7MLg2ydP28KFLX7B * test(mobile): lock the host-stack transition state machine Assert the replace waits for the host mount (zero dispatches before it, exactly one after), and cover cancel/retarget — the paths the shared pending transition relies on. * test(mobile): model listener removal in the navigation harness A no-op unsubscribe let setState keep calling a canceled listener, so the teardown assertions only exercised the active guard. Dropping the unsubscribe call from dispose now fails the suite. --------- Co-authored-by: kaynan <[email protected]>



Summary
Root cause
A cold deep push into the nested host navigator can resolve to its index route without the dynamic host ID. Live iOS simulator testing also showed that a dynamic route object can lose hostId during the second navigation. Mounting the host stack first and then using a concrete path preserves the selected host.
Test plan
Evidence
Physical TestFlight verification requires a build containing this change.