Allow hiding Orca Mobile sidebar button once a device is paired#5785
Conversation
|
Ready to review this PR? Stage has broken it down into 4 individual chapters for you:
Chapters generated by Stage for commit 404cf23 on Jun 19, 2026 8:15am UTC. |
📝 WalkthroughWalkthroughA new 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 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
🧹 Nitpick comments (1)
src/renderer/src/components/settings/MobilePane.test.tsx (1)
142-145: ⚡ Quick winAdd a mounted success-toast assertion.
The unmount test below is a negative assertion; without a positive control here, deleting
toast.successfromrevokeDevicewould still leave this suite green.Proposed test assertion
await vi.waitFor(() => expect(mocks.latestPairedDevicesProps?.devices.map((d) => d.deviceId)).toEqual(['phone-2']) ) + await vi.waitFor(() => expect(mocks.toastSuccess).toHaveBeenCalledTimes(1)) })
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 02095453-171f-454c-9f51-344891c7ee8d
📒 Files selected for processing (12)
src/renderer/src/components/mobile/MobileHeroPairedDevices.tsxsrc/renderer/src/components/mobile/MobilePage.tsxsrc/renderer/src/components/mobile/paired-mobile-devices.test.tssrc/renderer/src/components/mobile/paired-mobile-devices.tssrc/renderer/src/components/mobile/use-mobile-page-paired-devices.tssrc/renderer/src/components/settings/MobilePairedDevicesSection.tsxsrc/renderer/src/components/settings/MobilePane.test.tsxsrc/renderer/src/components/settings/MobilePane.tsxsrc/renderer/src/components/sidebar/SidebarNav.test.tsxsrc/renderer/src/components/sidebar/SidebarNav.tsxsrc/renderer/src/components/sidebar/mobile-sidebar-onboarding-badge.test.tssrc/renderer/src/components/sidebar/mobile-sidebar-onboarding-badge.ts
Introduce a shared external store (`paired-mobile-devices.ts`) to cache and synchronize the paired mobile device list across the sidebar, Settings pane, and Mobile page. This prevents redundant backend IPC requests when multiple surfaces mount simultaneously. Using this shared pairing status, display an inline "Hide from sidebar" control next to "Orca Mobile" in the navigation sidebar once a device has been paired. This allows users to easily declutter their sidebar after completing setup.
404cf23 to
5422437
Compare
- Add error flag to distinguish failed device loads from empty device lists - Recover from transient startup IPC failures by retrying on window focus or online - Validate revoke device success before routing or showing success toast - Only show hide control after first device is actually paired - Use snapshot getter to avoid manual device ref tracking in MobilePane
- Shared module-level listeners for failed load recovery reduce IPC spam compared to per-consumer event listeners on every focus/online event. - Optimistically remove revoked devices if post-revoke reload fails, keeping success toast and intro routing correct. - Prevent repo/branch label overflow with CSS text truncation. - Fix HTML entity rendering: use plain spaces instead of in translations so React text nodes render them correctly. - Add comprehensive tests for the paired devices hook covering load, navigation, revoke, and error recovery paths.
Summary
Allows hiding the Orca Mobile sidebar button once a device has been paired.
paired-mobile-devices.ts) to avoid duplicate IPC calls when the Sidebar, Settings pane, and Mobile page mount concurrently.EyeOffbutton with a tooltip) next to the "Orca Mobile" sidebar link when at least one paired device is present.useMobilePagePairedDevices.MobilePane(Settings) andSidebarNav.Screenshots
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildAdded unit tests in
paired-mobile-devices.test.tsto cover caching and coalescing logic, added integration/rendering tests inMobilePane.test.tsxto verify refresh/unmount flows, and updatedSidebarNav.test.tsxto verify the inline sidebar hide control.AI Review Report
The code review with the AI coding agent focused on:
listDevicescalls coalesce correctly to a single IPC call and that stale/superseded requests are ignored properly, preventing race conditions or flashing UI state.MobilePane) unmounts while an IPC call is in flight, state updates (e.g., toast notifications) do not execute on unmounted components.window.api.mobileandwindow.api.ui.writeClipboardText) and platform-agnostic layout structures. No hardcoded or platform-specific file paths or shortcuts were introduced or modified.Security Audit
window.api.mobile.revokeDevice({ deviceId })). It passes an existingdeviceIdsourced from paired devices list, mitigating injection risks.window.api.ui.writeClipboardTextutility.Notes
No platform-specific regressions are expected; behavior is uniform across macOS, Windows, and Linux.