Repository navigation
Keep your New GitHub issue draft after an accidental dismissal - #7778
Conversation
Dismissing the "New GitHub issue" dialog by clicking outside (or Escape/ Cancel) no longer discards the in-progress issue. The title, body, labels, assignees, and target repo are kept in a session-only store slice and restored when the dialog is reopened. The draft is cleared only on a successful create (or app restart). Reset-on-reopen was the data-loss point; the open handler now restores a content-non-empty draft instead of resetting. Repo-scoped labels/assignees are cleared only by a genuine user repo switch or when the chosen repo leaves the selection, so a restore never wipes them. Session-only and in-memory: not persisted to disk, so it does not survive an app restart. Scoped to the New GitHub issue dialog only.
📝 WalkthroughWalkthroughThis PR adds a session-persistent draft system for the "New GitHub issue" dialog in TaskPage. A new Zustand slice ( Sequence Diagram(s)Included above within the hidden review stack artifact for the TaskPage dialog wiring layer. Estimated code review effort: High Related PRs: None specified Suggested labels: enhancement, needs-review Suggested reviewers: None specified 🐰 A draft tucked safe in session's nest, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
Clean auto-merge, no conflicts. Brought in from main: - daemon boot hardening: fail builds/CI when terminal daemon can't start; plain-node-entry-guard + verify-packaged-daemon-entry (electron require leaked into daemon-entry chunk, #7844/#7849) - perf(windows): relax whole-process-table scans for terminals with no agent evidence (#7607) — foreground-scan-cadence - fix(agents): route WSL OMP hooks to the Windows listener (#7565/#7641) - fix: recover fresh local terminal spawns from a deleted saved cwd (#7847) - native-chat: upload composer attachments over SSH (#7832) - mobile: keyboard dismiss control; agent-tab launch fix - new GitHub issue draft persistence (#7778) Perf-branch structure preserved (clean auto-merge; no restructured terminal files conflicted). Gates: typecheck 0 errors; terminal-pane + ipc/pty + daemon + pane-manager suites 4497 passed / 14 skipped / 0 failed. Co-authored-by: Orca <[email protected]>
Summary
Dismissing the New GitHub issue dialog by clicking outside it (or pressing Escape, or clicking Cancel) no longer discards the in-progress issue. The title, body, labels, assignees, and target repo are kept in app state and restored when the dialog is reopened. The draft is cleared only after a successful create.
Boundary (what does not change): the draft is session-only / in-memory — not written to disk, so it does not survive an app restart. It survives close→reopen and navigating away from the Tasks view and back. Scope is the New GitHub issue dialog only; other create-modals are intentionally out of scope (see Notes). No confirmation prompt is added — recovery is silent.
Approach: the draft is lifted into a session-only store slice (
newIssueDraft, notpersist-wrapped), mirroring the existingnewWorkspaceDraftslice. Reset-on-reopen was the data-loss point; the+open handler now restores a content-non-empty draft (a barerepoId/empty form is not "content", so an untouched open never pins a meaningless draft). A content-gated write-through effect mirrors live edits into the slice while the dialog is open. Repo-scoped labels/assignees are cleared only by a genuine user repo switch or when the chosen repo leaves the selection — a restore never routes through a clear path, so it can't wipe just-restored fields (this replaces a reactive "clear on target-id change" effect that couldn't tell a restore apart from a switch).clearNewIssueDraft()runs in the submit-success block, withnewIssueOpenflipping false in the same commit so the write-through can't re-persist emptied fields. New logic lives in named modules:store/slices/new-issue-draft.tsandcomponents/task-page-new-issue-draft.ts(pure helpers), wired inTaskPage.tsx.Screenshots
Live Electron validation captured full-window screenshots of each state; verified during review:
DRAFT-RECOVERY-TEST: accidental dismissal should not lose my work+ a multi-line body.ESCAPE-FRESH-EDIT…, body, plusbrowser+buglabel chips and thebrennanb2025assignee all restored.Per repo policy, evidence images are not committed. Screenshots are attached to the PR conversation / shared with the reviewer rather than checked in.
Testing
pnpm typecheck— cleanpnpm lint—oxlintclean on all changed files; a full-repopnpm lintfails only on one pre-existing, unrelated file (right-sidebar/source-control-manual-review-url.ts), not part of this diffpnpm test— focused suites for the new slice + helpers pass (20/20):pnpm vitest run --config config/vitest.config.ts src/renderer/src/store/slices/new-issue-draft.test.ts src/renderer/src/components/task-page-new-issue-draft.test.ts(plus affected store suites); full suite not runpnpm build— not run (renderer-only change; typecheck + oxlint cover the touched surface)AI Review Report
Reviewed through Brennan's PR process end-to-end:
newIssueDraftwas subscribed in the very largeTaskPage, causing an extra full re-render per keystroke (the write-through changes object identity each keystroke). Fixed by reading it viauseAppStore.getState()at click time (TaskPage is the only consumer) → zero extra re-renders. Write-through is an O(1) store set (no disk/IPC); the vanish-guard keys on a memoizedselectedReposso it doesn't thrash; no leaks/polling/subprocess churn.labels/assigneesunder thePartialpatch API) — fixed with a per-seed factory + regression test. Round 2: both reviewers clean.Security Audit
Notes
pnpm lintfailure noted above is not introduced by this PR.