From 664b033071ae65bcfca7d85b71d056c83410b0af Mon Sep 17 00:00:00 2001 From: batistalucasv Date: Thu, 12 Nov 2026 12:52:55 -0300 Subject: [PATCH] Save As: don't open the rfd fallback after the portal dialog was given up (#6180) Giving the dialog up cancels the request. If the portal then fails with an error other than its cancellation code, the worker opened the rfd dialog even though nothing was waiting for the answer, leaving an unwanted Save dialog on screen. The fallback now checks this request's cancellation token first. --- apps/wordcraft/src/file_dialogs.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/wordcraft/src/file_dialogs.rs b/apps/wordcraft/src/file_dialogs.rs index 7e51e9b35c..f52edc9e52 100644 --- a/apps/wordcraft/src/file_dialogs.rs +++ b/apps/wordcraft/src/file_dialogs.rs @@ -168,9 +168,17 @@ impl Launcher { Ok(Vec::new()) } Err(e) => { - log::info!("portal save dialog unavailable ({e}), using rfd"); - let picked = pick(picking, unparented, TOO_QUICK); - picked.map(|f| f.iter().map(|f| f.path().to_string_lossy().to_string()).collect()) + // Giving the dialog up cancels the request. A portal that then + // fails with another error must not open the rfd dialog, which + // nothing would be waiting for. + if portal_arm.as_ref().is_some_and(|armed| armed.token.is_cancelled()) { + log::info!("portal save dialog given up ({e})"); + Ok(Vec::new()) + } else { + log::info!("portal save dialog unavailable ({e}), using rfd"); + let picked = pick(picking, unparented, TOO_QUICK); + picked.map(|f| f.iter().map(|f| f.path().to_string_lossy().to_string()).collect()) + } } } } else {