Repository navigation
fix(web): ask for confirmations with an in-app dialog instead of window.confirm - #132
Merged
Merged
Conversation
The desktop shell has no usable window.confirm: its dialog plugin swaps it for an async stub, so a guarded action runs without asking. Add ConfirmDialog on the shared Modal and useConfirmDialog, a promise wrapper shaped like the confirm() calls it replaces. Signed-off-by: Dennis Menken <dennis@lass-machen.me>
Revoking one session or all other sessions relied on window.confirm, which never asks in the desktop shell, and reported the result with alert(). Use the in-app confirm dialog and show the result inline. Signed-off-by: Dennis Menken <dennis@lass-machen.me>
The invite list asked through window.confirm, which never asks in the desktop shell. Use the in-app confirm dialog. Signed-off-by: Dennis Menken <dennis@lass-machen.me>
Removing a member asked twice: the member row called window.confirm and then handleRemoveMember called it again. In the desktop shell neither ever asked. Ask once, in the row, with the in-app confirm dialog. Signed-off-by: Dennis Menken <dennis@lass-machen.me>
The editor asked through window.confirm, which never asks in the desktop shell. Use the in-app confirm dialog. Signed-off-by: Dennis Menken <dennis@lass-machen.me>
Native dialogs do not work in the desktop shell. Enable no-alert for apps/web so the in-app ConfirmDialog stays the only way to ask. Signed-off-by: Dennis Menken <dennis@lass-machen.me>
Signed-off-by: Dennis Menken <dennis@lass-machen.me>
…e silently The invite list removed a row without looking at the DELETE response, so a rejected delete made a still valid invite disappear from the screen. Check the status, show an error and keep the row; 404 counts as already deleted. Signed-off-by: Dennis Menken <dennis@lass-machen.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
window.confirmdoes not work in the desktop app: the Tauri dialog plugin replaces it with an async stub (window.confirm = async function ..., no sync IPC), so!confirm(...)is never true and the guarded action runs without asking. This was found while reviewing #131 and read from the plugin source of the locked crates; it was not run in the desktop app. This PR adds an in-appConfirmDialogon the sharedModal(no@tauri-appsimport) and moves every native dialog inapps/webonto it.Type of change
Affected components
apps/webWhat changes
ConfirmDialoganduseConfirmDialoginui/system. The hook is promise based and shaped like the calls it replaces (if (!(await confirm(message))) return;); every way of not confirming (cancel, Escape, close, replaced by a newer request, owner unmounted) resolvesfalse.SessionManagement: revoke one / revoke all others. Thealert()for the result is now an inline success notice.InvitesTab: delete invite.MemberSettings: remove member. Removing a member used to ask twice (the row andhandleRemoveMemberboth calledconfirm); the confirmation now lives in the row only.EditorWindow: delete asset pack (not in the original list of five; found by grep).no-alertforapps/web, so nativeconfirm,alertandpromptcannot come back. A grep found no other call inapps/web.InvitesTabnow checks the DELETE response: a rejected delete or a network error shows an error and keeps the row, 404 counts as already deleted.How was this tested?
confirmnever called) plus component and hook tests for the dialog itself.no-alertrule was checked by adding aconfirm()and analert()to a web file: both are reported.scripts/ci-local.sh --full: lint, budgets, typecheck, shared/web/server tests (web 872) and build pass.format:checkfails only on the pre-existing.codex/hooks.json.Notes
Breaking changes
Licensing checklist
git commit --signoff).CONTRIBUTING.md: left for the author to confirm.