Clear PR caches after the draft toggle resolves #785
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
fugitive
good first issue
help wanted
invalid
question
v0.1.0
v0.2.0
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
barrettruth/forge.nvim!785
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/pr-edit-draft-toggle-sequence"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Checklist
Problem
Editing a PR's metadata to flip draft on a native-draft backend (GitHub/GitLab) applies the draft change through a separate
draft_toggle_cmdafter the main update.update_prdispatched that command but then ranclear_list()and reported the submit done synchronously — before the toggle resolved. A refresh could race the in-flight toggle and re-cache the stale draft state, and a failed toggle was only logged while the edit still reported success. (Forgejo folds draft into the title via the main update, so it was unaffected.)Solution
Move the post-update finalize (
clear_list()+ completion) into afinish()step that runs after the draft toggle resolves, mirroring the existingapply_created_pr_reviewersfollow-up. When no toggle is needed it runs immediately; on toggle failure the error is logged and the edit still finishes. Adds regression specs covering both: caches clear only after the toggle resolves, and a failed toggle still finishes.