mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-14 03:56:55 +03:00
fix(tui): dismiss update notification only on skip
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user