fix(tui): dismiss update notification only on skip

This commit is contained in:
Dax Raad
2026-09-06 02:42:12 -04:00
Unverified
parent e64b2bc137
commit 8ea99ef9ad
2 changed files with 12 additions and 4 deletions
+11 -1
View File
@@ -10,6 +10,7 @@ import { Spinner } from "./spinner"
export function DialogUpdate(props: {
check?: (signal: AbortSignal) => Promise<string | undefined>
state: () => UpdateState | undefined
skip: () => void
install: () => Promise<void>
restart: () => void
}) {
@@ -47,7 +48,16 @@ export function DialogUpdate(props: {
: type === "installed"
? { label: "Restart", run: props.restart }
: undefined
return [{ label: "Skip", run: () => dialog.clear() }, ...(confirm ? [confirm] : [])]
return [
{
label: "Skip",
run: () => {
props.skip()
dialog.clear()
},
},
...(confirm ? [confirm] : []),
]
})
createEffect(() => setActive(Math.max(0, buttons().length - 1)))
@@ -95,14 +95,12 @@ export const { use: useUpdateNotification, provider: UpdateNotificationProvider
// The notification can predate an installation through /update.
if (known && active?.type !== "installing" && !(active?.type === "installed" && active.version === known.version))
setState({ type: known.type, version: known.version })
// Manual checks hide the current notice without marking the version as seen.
if (origin === "manual") setNotification(undefined)
if (origin === "notification") dismiss()
const status = state()?.type
dialog.replace(() => (
<DialogUpdate
check={status === undefined || status === "failed" ? check : undefined}
state={state}
skip={dismiss}
install={install}
restart={restart}
/>