Repository navigation
fix(mobile): open Create Workspace after source drawer closes - #31488
Conversation
Co-authored-by: Jian Zhou <16776397+ZhouJian26@users.noreply.github.com>
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
8b0c8d97-70db-4972-aed9-bb9aee086153
📒 Files selected for processing: 8
mobile/src/components/use-bottom-drawer-follow-up.test.tsxmobile/src/components/use-bottom-drawer-follow-up.tsmobile/src/tasks/mobile-tasks-create-drawers.tsxmobile/src/tasks/mobile-tasks-create-handoff.test.tsxmobile/src/tasks/mobile-tasks-item-actions.tsxmobile/src/tasks/mobile-tasks-item-detail-drawer.tsxmobile/src/tasks/mobile-tasks-project-detail-drawer.tsxmobile/src/tasks/use-mobile-tasks-workspace-and-project-state.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- hook references and file ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'useBottomDrawerFollowUp' -e 'keyed-bottom-drawer' -e 'closeThen' mobile/src mobile 2>/dev/null | head -200
printf '%s\n' '--- hook ---'
nl -ba mobile/src/components/use-bottom-drawer-follow-up.ts
printf '%s\n' '--- keyed drawer candidates ---'
rg --files mobile/src | rg 'keyed-bottom-drawer\.tsx?$|bottom-drawer'
for f in $(rg --files mobile/src | rg 'keyed-bottom-drawer\.tsx?$'); do
printf '%s\n' "--- $f ---"
nl -ba "$f"
done
printf '%s\n' '--- focused tests ---'
rg -n -F --glob '*.{test,spec}.{ts,tsx}' -e 'closeThen' -e 'onAfterClose' -e 'useBottomDrawerFollowUp' mobile 2>/dev/null | head -200Repository: stablyai/orca
Length of output: 15920
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- concrete follow-up bindings ---'
nl -ba mobile/src/tasks/use-mobile-tasks-workspace-and-project-state.tsx | sed -n '120,180p'
nl -ba mobile/src/tasks/mobile-tasks-create-drawers.tsx | sed -n '280,355p'
nl -ba mobile/src/tasks/mobile-tasks-item-actions.tsx | sed -n '1,75p'
nl -ba mobile/src/tasks/mobile-tasks-project-detail-drawer.tsx | sed -n '220,270p'
printf '%s\n' '--- mounted drawer callback contract ---'
nl -ba mobile/src/components/mounted-bottom-drawer.tsx | sed -n '1,240p'
printf '%s\n' '--- follow-up tests ---'
nl -ba mobile/src/components/use-bottom-drawer-follow-up.test.tsx
printf '%s\n' '--- keyed drawer lifecycle tests ---'
nl -ba mobile/src/components/keyed-bottom-drawer.test.tsx | sed -n '120,235p'Repository: stablyai/orca
Length of output: 29523
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- BottomDrawer wrapper ---'
nl -ba mobile/src/components/BottomDrawer.tsx
printf '%s\n' '--- relevant close lifecycle tests ---'
nl -ba mobile/src/components/bottom-drawer-close-lifecycle.test.ts | sed -n '1,145p'
printf '%s\n' '--- exact closeThen call contexts ---'
rg -n -F --glob '*.tsx' -e 'taskDetailHandoff.closeThen' -e 'projectRowHandoff.closeThen' -e 'repoPickerHandoff.closeThen' mobile/srcRepository: stablyai/orca
Length of output: 6701
🏁 Script executed:
nl -ba mobile/src/components/mounted-bottom-drawer.tsx | sed -n '228,380p'Repository: stablyai/orca
Length of output: 6478
Clear pending work on user dismissal.
closeThen can queue an action without a new close lifecycle. A later user dismissal can then run that stale action in onAfterClose. Clear pending work in onClose, and queue the action after the programmatic close.
🐛 Suggested fix
--- "a/mobile/src/components/use-bottom-drawer-follow-up.ts"
+++ "b/mobile/src/components/use-bottom-drawer-follow-up.ts"
@@ -9,12 +9,15 @@
[]
)
return {
closeThen(action: () => void) {
- pending.current = action
close()
+ pending.current = action
},
drawerProps: {
- onClose: close,
+ onClose() {
+ pending.current = null
+ close()
+ },
onAfterClose() {
const action = pending.current
pending.current = null
ELI5
When you tap Create Workspace, the current drawer now finishes closing before the create screen opens. The old drawer can no longer hide the next step.
What was wrong
Tapping Create Workspace from a mobile task or GitHub project row could open the next sheet while its source drawer was still on screen. The old drawer could cover the create flow.
What changes
Close the current drawer, wait for its existing
onAfterCloselifecycle, then open the next surface. The same handoff covers GitHub tasks, GitHub project rows, and Linear/Jira repository selection. The chosen task and repository are captured before closing. Pending work runs once and is discarded when the screen unmounts.Fixes #17558.
Verification
TerminalWebView.tsxWebView prop/type errors at lines 73 and 89–91.localization_pairing: no blocking findings.Before and after
Actual native simulator screenshots use production Tasks action handlers, source drawers, picker, and
BottomDrawerlifecycle in a temporary React Native fixture. The fixture supplies task/repository data and replaces the final create form with a confirmation sheet; it does not exercise a real provider or create a workspace. Temporary entrypoint/Metro changes are excluded from this PR.Before: the original GitHub drawer remains above Create after tapping the action.
After: the source drawer has closed and Create is visible.
Community credit
Adapted @ZhouJian26's close-then-open approach from #13147 to the current split Tasks modules, including the newer Jira path. The commit credits Jian Zhou as co-author.
Risk
Low: changes UI sequencing through the existing drawer lifecycle, with no RPC or server changes. Shared mobile components retain the current local/remote and folder/git workspace behavior. Native proof covers iOS; Android was not available for device verification.
Additional risk verification
Reviewed handoff ownership, duplicate completion, backdrop/swipe dismissal and screen-unmount cleanup. The existing production BottomDrawer lifecycle tests and native task/project/Linear/Jira evidence are retained, with the current-main integrated suite checking their interaction. No wire or runtime mutation change was needed. Residual merge risk: low.