fix(decky): stop toasting on every launch and every failed panel refresh

Field complaint: the plugin toasts too much. Inventory of all 14 toast
sites says almost all are rare, explicit-tap feedback (pairing, update
buttons, recovery actions) — but two were routine-volume offenders:

  * startStream toasted "Starting stream — <host>" on EVERY successful
    launch, i.e. the overwhelming majority of all toasts the plugin ever
    shows. It repeats the button the user just pressed, and lands ON TOP
    of the starting stream after the QAM closes. Gone; launch FAILURES
    still toast (the QAM may already be closed, so inline state would go
    unseen).
  * useHosts.refresh() toasted "Couldn't list hosts" from its catch —
    and the panel remounts (and refreshes) on every QAM open, so a broken
    backend nagged on each open. It's now a third inline `problem` row
    ("Couldn't scan for hosts"), sitting next to the Refresh button that
    retries it, like the client-unavailable/client-outdated states
    already did.

The update-flow, pairing, trust and recovery toasts stay: each is a rare,
single, information-carrying response to an explicit tap (or, for the
request-access hint, the only warning that the connect is about to park).

Verified: tsc --noEmit and the rollup bundle pass.
This commit is contained in:
2026-08-12 22:05:16 +02:00
parent 79dba7f95a
commit 339a1d70f9
2 changed files with 18 additions and 6 deletions
+12 -4
View File
@@ -215,9 +215,10 @@ export function useHosts() {
const [views, setViews] = useState<HostView[]>([]);
const [scanning, setScanning] = useState(false);
// Why the list is empty, when it is empty for a reason other than an empty LAN. Rendering
// either of these as "No hosts yet" would blame the user's network for the plugin's problem:
// any of these as "No hosts yet" would blame the user's network for the plugin's problem:
// "client-outdated" — the installed client predates `punktfunk discover`
// "client-unavailable" — there is no client installed at all
// "list-failed" — the refresh itself blew up (backend down, call threw)
const [problem, setProblem] = useState<string | null>(null);
const refresh = useCallback(async () => {
@@ -236,7 +237,11 @@ export function useHosts() {
);
setViews(mergeHosts(s.hosts ?? [], d.hosts ?? []));
} catch (e) {
toaster.toast({ title: "Punktfunk", body: `Couldn't list hosts: ${e}` });
// Inline, not a toast: the panel remounts (and refreshes) on every QAM open, so while
// the backend is unhappy a toast here nagged on each open. The panel row also sits next
// to the Refresh button that retries it, which is where the eyes already are.
console.warn("punktfunk: host list refresh failed", e);
setProblem("list-failed");
} finally {
setScanning(false);
}
@@ -454,9 +459,12 @@ export async function startStream(
): Promise<void> {
try {
await launchStream(v.ref, opts);
// No success toast: the user just pressed the button that names this host/card, the QAM
// closes, and Steam's own launch UI takes over — a toast here fired on EVERY launch and
// then sat on top of the starting stream. Failure still toasts (the QAM may already be
// closed, so inline error state would go unseen).
Navigation.CloseSideMenus();
toaster.toast({ title: "Punktfunk", body: `Starting ${label ?? "stream"}${v.name}` });
} catch (e) {
toaster.toast({ title: "Punktfunk", body: `Launch failed: ${e}` });
toaster.toast({ title: "Punktfunk", body: `Launch failed${label ? ` (${label})` : ""}: ${e}` });
}
}
+6 -2
View File
@@ -230,12 +230,16 @@ const QamPanel: FC = () => {
label={
problem === "client-unavailable"
? "Punktfunk isnt installed"
: "Update the Punktfunk client"
: problem === "list-failed"
? "Couldnt scan for hosts"
: "Update the Punktfunk client"
}
description={
problem === "client-unavailable"
? "This panel launches the Punktfunk app, which isnt on this Deck yet. Install it in Desktop Mode."
: "This client is too old to find hosts on your network. Saved hosts still work."
: problem === "list-failed"
? "Something went wrong while scanning — Refresh tries again."
: "This client is too old to find hosts on your network. Saved hosts still work."
}
/>
</PanelSectionRow>