fix(mobile): open Create Workspace after source drawer closes by nwparker · Pull Request #31488 · stablyai/orca · GitHub
Skip to content

fix(mobile): open Create Workspace after source drawer closes - #31488

Merged
nwparker merged 2 commits into
mainfrom
nwparker/mobile-source-drawer
Oct 21, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/mobile-source-drawer

Conversation

@nwparker

@nwparker nwparker commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​199 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​199
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​60 $\color{#cf222e}{\Huge{\mathbf{−}}}$​19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​41

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 onAfterClose lifecycle, 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

  • Five source-action regressions fail on the unchanged implementation; all 10 handoff/source-action/existing close-lifecycle tests pass with the fix.
  • Changed-code quality gate passes with no new findings.
  • Full mobile and tests typecheck reaches only the existing TerminalWebView.tsx WebView prop/type errors at lines 73 and 89–91.
  • Independent review by localization_pairing: no blocking findings.
  • Native iOS 26.1 on a simslim emulator: verified GitHub task → Create; Linear and Jira → repository picker → Create with the selected second repository; GitHub project row → Create.

Before and after

Actual native simulator screenshots use production Tasks action handlers, source drawers, picker, and BottomDrawer lifecycle 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.

Before: source drawer blocks Create

After: the source drawer has closed and Create is visible.

After: 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.

Co-authored-by: Jian Zhou <16776397+ZhouJian26@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

Added useBottomDrawerFollowUp to run queued actions after a drawer closes. Mobile task creation flows use it for task details, project rows, and the workspace repository picker. Tests cover deferred execution, dismissal behavior, repeated close notifications, and cleanup when the screen unmounts.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: 🔵 Low · up to e5338

A later drawer dismissal could unexpectedly start workspace creation. Clear stale pending work before merging, or accept this bounded risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: opening Create Workspace after the source drawer closes.
Linked Issues check Passed Issue #17558 requires the mobile Create Workspace handoff to wait for source-drawer closure and include navigation coverage. The PR adds useBottomDrawerFollowUp, which queues one action, closes the …
Out of Scope Changes check Passed The changes remain within issue #17558. The new hook and tests support drawer sequencing, lifecycle handling, and the affected Create Workspace source actions. The PR changes no server or RPC behavior…
Description check Passed The pull request description is mostly complete. It explains the problem, user-facing change, implementation approach, linked issue, visual proof, testing results, risks, limitations, and additional v…
Full details: Linked Issues check

Explanation

Issue #17558 requires the mobile Create Workspace handoff to wait for source-drawer closure and include navigation coverage. The PR adds useBottomDrawerFollowUp, which queues one action, closes the current drawer, and runs the action from the existing onAfterClose lifecycle. The task-detail, GitHub project-row, and Linear/Jira repository-picker flows use this handoff. The code captures task and repository values before closure. Tests cover the handoff timing, one-shot behavior, dismissal behavior, unmount cleanup, and all listed source flows. The PR also reports native iOS simulator coverage for the requested flows.

Full details: Out of Scope Changes check

Explanation

The changes remain within issue #17558. The new hook and tests support drawer sequencing, lifecycle handling, and the affected Create Workspace source actions. The PR changes no server or RPC behavior and introduces no unrelated product flow.

Full details: Description check

Explanation

The pull request description is mostly complete. It explains the problem, user-facing change, implementation approach, linked issue, visual proof, testing results, risks, limitations, and additional verification. It does not include the template's explicit Review, Agent skill upstream boundary, Notes, or Checklist sections, and it does not state AI disclosure. These omissions are non-critical because the required change rationale and validation details are otherwise covered.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8b0c8d97-70db-4972-aed9-bb9aee086153
📥 Commits

Reviewing files that changed from the base of the PR and between 29a1446 and e533874.

📒 Files selected for processing: 8
  • mobile/src/components/use-bottom-drawer-follow-up.test.tsx
  • mobile/src/components/use-bottom-drawer-follow-up.ts
  • mobile/src/tasks/mobile-tasks-create-drawers.tsx
  • mobile/src/tasks/mobile-tasks-create-handoff.test.tsx
  • mobile/src/tasks/mobile-tasks-item-actions.tsx
  • mobile/src/tasks/mobile-tasks-item-detail-drawer.tsx
  • mobile/src/tasks/mobile-tasks-project-detail-drawer.tsx
  • mobile/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.

Comment on lines +12 to +15

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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 -200

Repository: 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/src

Repository: 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

@nwparker
nwparker merged commit a33d596 into main Oct 21, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open mobile Create Workspace after the source drawer closes

1 participant