Skip to content

Fix stuck UI after unapply failure#13737

Merged
mtsgrd merged 1 commit into
masterfrom
mg-branch-64
May 9, 2026
Merged

Fix stuck UI after unapply failure#13737
mtsgrd merged 1 commit into
masterfrom
mg-branch-64

Conversation

@mtsgrd
Copy link
Copy Markdown
Contributor

@mtsgrd mtsgrd commented May 9, 2026

When stackService.unapply() fails (e.g. branch already removed, backend error), the UI gets stuck — context menus stay open and stale stacks remain visible because the cleanup code only ran on the success path.

In BranchHeaderContextMenu.svelte, close() was called sequentially after await unapply(), and in StackDragHandle.svelte, stacksQuery.result.refetch() was likewise awaited after the call. An error in either case meant cleanup never executed.

Wrapped both call sites in try/finally so cleanup always runs regardless of whether the backend call succeeds or fails.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Ensures the desktop UI recovers cleanly when stackService.unapply() fails by moving UI cleanup actions into finally blocks, preventing stuck context menus and stale stack lists after backend errors.

Changes:

  • Always close the branch header context menu even if unapply() throws.
  • Always refetch stacks after an unapply attempt so stale stacks don’t remain visible.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
apps/desktop/src/components/stack/StackDragHandle.svelte Wraps unapply() in try/finally to refetch stacks even on failure.
apps/desktop/src/components/branch/BranchHeaderContextMenu.svelte Wraps unapply() in try/finally to ensure the menu closes even on failure.

Comment thread apps/desktop/src/components/stack/StackDragHandle.svelte
When `stackService.unapply()` fails, the UI gets stuck — context menus
stay open and stale stacks remain visible because the cleanup code
only ran on the success path.

In `BranchHeaderContextMenu.svelte`, `close()` was called sequentially
after `await unapply()`, and in `StackDragHandle.svelte`,
`stacksQuery.result.refetch()` was likewise awaited after the call.
An error in either case meant cleanup never executed.

Wrapped both call sites in `try/finally` so cleanup always runs
regardless of whether the backend call succeeds or fails.
@mtsgrd mtsgrd changed the base branch from mg-branch-63 to master May 9, 2026 20:11
@mtsgrd mtsgrd merged commit 577e759 into master May 9, 2026
36 checks passed
@mtsgrd mtsgrd deleted the mg-branch-64 branch May 9, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants