Skip to content

fix: stop cancelled confirm dialogs from running actions - #312

Merged
MrYuion merged 4 commits into
developfrom
fix/confirm-cancel-deletes
Sep 30, 2026
Merged

MrYuion merged 4 commits into
developfrom
fix/confirm-cancel-deletes

Conversation

@MrYuion

@MrYuion MrYuion commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

Problem

openConfirmModal always returns an object. Six callers checked if (!details) return, which never stops the action. Cancel, Escape or a backdrop click still deleted the item:

  • Delete application (domains)
  • Delete edge, broker, build job and signage plugin (admin)
  • Reorder trigger actions (triggers)

Escape or a backdrop click during the request also closed the dialog. Material then clears componentInstance, so the later loading.set() call threw.

This is part of a stack of 6 PRs from a review of the whole app. Merge them in order: confirm-cancel, security, data loss, broken features, async errors, cleanup. Each PR targets the branch before it, so the diff shows only its own changes.

Fix

  • All callers of openConfirmModal now check details.reason !== 'done'. Select dialogs that resolve with 'action' check for that reason.
  • Every caller closes the dialog on success and on failure. Before, some spinners stayed on after an error.
  • The confirm modal sets disableClose while it is loading. The receipt view can still be closed.
  • Remove trigger and remove module on a system now show a loading state.
  • Rename ConfirmRepsonse to ConfirmResponse and type reason as optional.

Checks

  • tsc, bun run lint, bunx vitest run (955 tests) pass. New tests cover a dismissed modal and disableClose while loading. Both fail without the fix.
  • All 6 branches were merged and tested in a browser against a local PlaceOS stack (nightly images, with core and triggers). Test agents created their own records, checked results through the API, and removed the records after. Cancel, Escape and backdrop click sent no request for every delete dialog in the app. Confirm deleted the item.

Made by Claude Opus 5.5 (1M context) in Claude Code (T3 Code).

🤖 Generated with Claude Code

MrYuion and others added 4 commits September 30, 2026 11:02
Escape or a backdrop click during an action closed the dialog. Material
then nulls componentInstance, and the next loading.set() threw. The modal
now sets disableClose while loading is set, and wrappers that touch
componentInstance after an await use optional chaining.

Also rename ConfirmRepsonse to ConfirmResponse, type reason as
'done' | undefined (it is undefined on dismiss), and move the receiptToTsv
JSDoc back above its function.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
openConfirmModal always resolves to an object, so `if (!details) return`
never fired. Cancel, Escape and backdrop clicks still ran the delete in
domains (application), edge, build list, brokers, signage plugins and
trigger reorder. All callers now use `details.reason !== 'done'`.

Also close the modal on every path so no spinner is left stuck:
- trigger reorder now closes on success and error, with a reorder icon
- metadata removal now closes the modal after confirming
- api keys, storage, upload library and resource imports close in a
  finally block when the request throws

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Select and trigger-settings dialogs resolve with reason 'action', not
'done', so the stricter check skipped the action every time. Dialogs
that race afterClosed() can also resolve with undefined.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Without it the confirm buttons stay live during the request.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
backoffice Ready Ready Preview Sep 30, 2026 3:21am UTC

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@MrYuion
MrYuion merged commit bcc8e9d into develop Sep 30, 2026
6 of 8 checks passed
@MrYuion
MrYuion deleted the fix/confirm-cancel-deletes branch September 30, 2026 04:37

This branch was successfully deployed

1 active deployment
Preview — 9e725c59 Deployed Sep 30, 2026 by vercel[bot]
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.

1 participant