[WRONG BRANCH] fix(gui): protect parked prompt-layer drafts - #360
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 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 |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Its title has been prefixed with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce8cb8eab3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <button | ||
| type="button" | ||
| className="btn btn-danger btn-sm" | ||
| onClick={() => discardAction === "save" ? onSave({ ...draft, body: normalized }) : onClose()} |
There was a problem hiding this comment.
Preserve the layer selected when Save was requested
When a parked draft triggers the Save confirmation, discardAction records only "save" while draft continues to follow the displayed layer. The header navigation remains enabled, so moving to another layer before clicking Discard makes this callback save that newly displayed layer instead of the layer for which Save was requested; pressing Escape similarly routes through requestClose and changes the pending action to "close". Capture the pending normalized draft when opening the confirmation, or lock navigation and treat Escape as cancellation while it is active.
AGENTS.md reference: gui/AGENTS.md:L31-L34
Useful? React with 👍 / 👎.
Motivation
Description
draftsRefand aparkedDirtyflag; addedothersRefto safely compare against the saved layers without widening effect deps.discardActionand routing close/save throughrequestClose/requestSavewhich show the existing discard UI when needed.requestSaveso a Save from another layer defers until the user confirms discard/save of parked drafts.8b. closing or saving another layer warns about a parked edit) ingui/tests/codex-set-stack.test.tsxthat exercises both the close and save paths and verifies the server PUT behavior.Testing
cd gui && bun test tests/codex-set-stack.test.tsx, and all tests in that file passed (including the new regression).cd gui && bun run lintandcd gui && bun run buildand both completed successfully (lint produced only a benign hook warning earlier that was addressed).cd gui && bun test testsrun exercised the wider suite; the focused changes are green but the full suite encountered unrelated environment-specific failures (missing Jest timer helpers and anode:zlibsymbol) that are not caused by this change.Codex Task