Skip to content

Commit 45230cd

Browse files
committed
fix: avoid false exit errors in close prompt
1 parent 0392943 commit 45230cd

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

scripts/ui/close-confirm.test.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,11 @@ test('close confirm dialog only schedules frontend close fallback for tray actio
4848
assert.match(html, /recoveryTimer = window\.setTimeout\(/);
4949
assert.match(html, /window\.close\(\);/);
5050
});
51+
52+
test('close confirm dialog suppresses invoke teardown errors for exit actions', async () => {
53+
const html = await readHtml();
54+
55+
assert.match(html, /catch \(_invokeError\) \{/);
56+
assert.match(html, /if \(action === exitAction\) \{/);
57+
assert.match(html, /return;/);
58+
});

src-tauri/src/window/close_confirm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use tauri::{AppHandle, Manager, WebviewUrl, WebviewWindowBuilder};
22

33
pub(crate) const CLOSE_CONFIRM_WINDOW_LABEL: &str = "close-confirm";
4-
const CLOSE_CONFIRM_WINDOW_WIDTH: f64 = 420.0;
5-
const CLOSE_CONFIRM_WINDOW_HEIGHT: f64 = 320.0;
4+
const CLOSE_CONFIRM_WINDOW_WIDTH: f64 = 404.0;
5+
const CLOSE_CONFIRM_WINDOW_HEIGHT: f64 = 292.0;
66

77
pub(crate) fn build_close_confirm_path(locale: &str) -> String {
88
format!(
@@ -102,7 +102,7 @@ mod tests {
102102

103103
#[test]
104104
fn close_confirm_window_size_fits_desktop_dialog_without_clipping() {
105-
assert_eq!(close_confirm_window_size(), (420.0, 320.0));
105+
assert_eq!(close_confirm_window_size(), (404.0, 292.0));
106106
}
107107

108108
#[test]

ui/close-confirm.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828

2929
.dialog {
3030
box-sizing: border-box;
31-
width: min(100%, 420px);
32-
padding: 20px;
31+
width: 100%;
32+
padding: 12px;
3333
}
3434

3535
.card {
@@ -108,7 +108,7 @@
108108

109109
@media (max-width: 380px) {
110110
.dialog {
111-
padding: 16px;
111+
padding: 10px;
112112
}
113113

114114
.actions {
@@ -257,6 +257,9 @@ <h1 id="title"></h1>
257257
}
258258
}
259259
} catch (_invokeError) {
260+
if (action === exitAction) {
261+
return;
262+
}
260263
error.textContent = copy.submitError;
261264
setPending(false);
262265
}

0 commit comments

Comments
 (0)