From 1213fd18cf2f51743f437e8aab1dbd1e87861072 Mon Sep 17 00:00:00 2001 From: Johnny Eric Amancio Date: Thu, 13 Aug 2026 21:12:27 +0200 Subject: [PATCH] fix(tui): stop leftover toast titles during update install SolidJS store merge kept the previous toast title when the next toast omitted it, so the update prompt reused "MCP Authentication Required". --- .changeset/tui-toast-title-leak.md | 5 +++ packages/tui/src/ui/toast.tsx | 3 +- packages/tui/test/kilocode/toast.test.tsx | 37 +++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .changeset/tui-toast-title-leak.md create mode 100644 packages/tui/test/kilocode/toast.test.tsx diff --git a/.changeset/tui-toast-title-leak.md b/.changeset/tui-toast-title-leak.md new file mode 100644 index 00000000000..2f23c205d24 --- /dev/null +++ b/.changeset/tui-toast-title-leak.md @@ -0,0 +1,5 @@ +--- +"@kilocode/cli": patch +--- + +Stop leftover toast titles from appearing when installing a TUI update. diff --git a/packages/tui/src/ui/toast.tsx b/packages/tui/src/ui/toast.tsx index 61b7f4c94ad..a89539b7a5e 100644 --- a/packages/tui/src/ui/toast.tsx +++ b/packages/tui/src/ui/toast.tsx @@ -1,5 +1,6 @@ import { createContext, useContext, type ParentProps, Show } from "solid-js" import { createStore } from "solid-js/store" +import { reconcile } from "solid-js/store" // kilocode_change import { useTheme } from "../context/theme" import { useTerminalDimensions } from "@opentui/solid" import { SplitBorder } from "./border" @@ -60,7 +61,7 @@ function init() { const toast = { show(options: ToastInput) { const toastOptions = { ...options, duration: options.duration ?? 5000 } - setStore("currentToast", toastOptions) + setStore("currentToast", reconcile(toastOptions)) // kilocode_change if (timeoutHandle) clearTimeout(timeoutHandle) // kilocode_change start timeoutHandle = null diff --git a/packages/tui/test/kilocode/toast.test.tsx b/packages/tui/test/kilocode/toast.test.tsx new file mode 100644 index 00000000000..be28b6792e6 --- /dev/null +++ b/packages/tui/test/kilocode/toast.test.tsx @@ -0,0 +1,37 @@ +/** @jsxImportSource @opentui/solid */ +import { expect, test } from "bun:test" +import { testRender } from "@opentui/solid" +import { ToastProvider, useToast } from "../../src/ui/toast" + +test("replacing a toast does not keep the previous title", async () => { + let toast: ReturnType + function Probe() { + toast = useToast() + return + } + + const app = await testRender(() => ( + + + + )) + + try { + toast!.show({ + title: "MCP Authentication Required", + message: `Server "foo" requires authentication.`, + variant: "warning", + duration: 0, + }) + toast!.show({ + variant: "info", + message: "Updating to v7.4.21...", + duration: 0, + }) + expect(toast!.currentToast?.title).toBeUndefined() + expect(toast!.currentToast?.message).toBe("Updating to v7.4.21...") + expect(toast!.currentToast?.variant).toBe("info") + } finally { + app.renderer.destroy() + } +})