fix(launcher): keep native open state off download spinner\n\nAdd an opt-out on the shared hosted-file button so promise-returning native opens\ncan use Launcher status text without being treated like active downloads. Apply it\nto the Electron launcher open path so cache hits no longer show 'Downloading...'\nwhen the row status already reports the correct cache/open state.

This commit is contained in:
Scott Idem
2026-05-12 13:49:55 -04:00
parent f8fe4ac5a2
commit 8dd22912c3
2 changed files with 6 additions and 2 deletions

View File

@@ -35,6 +35,7 @@ interface Props {
require_auth?: boolean;
classes?: string;
click?: () => void | Promise<any>;
track_click_promise?: boolean;
label?: import('svelte').Snippet;
}
@@ -57,6 +58,7 @@ let {
require_auth = true,
classes = '',
click,
track_click_promise = true,
label
}: Props = $props();
@@ -193,8 +195,9 @@ async function handle_click() {
if (click) {
const result = click();
// If the override returns a promise, track it so the UI shows progress
if (result instanceof Promise) {
// If the override returns a promise, track it so the UI shows progress.
// Launcher open flows can opt out so native status messages stay authoritative.
if (track_click_promise && result instanceof Promise) {
ae_promises[file_id] = result;
}
return;

View File

@@ -593,6 +593,7 @@ function prevent_default<T extends Event>(fn: (event: T) => void) {
hosted_file_id={event_file_id}
hosted_file_obj={event_file_obj}
require_auth={false}
track_click_promise={!($ae_loc.is_native && $events_loc.launcher.app_mode === 'native')}
classes="btn {btn_size} gap-1 justify-between min-w-full w-full max-w-96 preset-tonal-primary border border-primary-500"
click={handle_open_file}>
{#snippet label()}