From c5f94aa73279562761cf3945dbff54b7b46b9bcd Mon Sep 17 00:00:00 2001 From: Charles Packer Date: Tue, 17 Feb 2026 18:05:41 -0800 Subject: [PATCH] fix(cli): truncate static history during resize redraw (#1002) Co-authored-by: Letta --- src/tests/cli/resize-redraw-wiring.test.ts | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/tests/cli/resize-redraw-wiring.test.ts diff --git a/src/tests/cli/resize-redraw-wiring.test.ts b/src/tests/cli/resize-redraw-wiring.test.ts new file mode 100644 index 0000000..4cf357f --- /dev/null +++ b/src/tests/cli/resize-redraw-wiring.test.ts @@ -0,0 +1,35 @@ +import { describe, expect, test } from "bun:test"; +import { readFileSync } from "node:fs"; +import { fileURLToPath } from "node:url"; + +describe("resize redraw wiring", () => { + test("does not define lossy static-item resize cap", () => { + const appPath = fileURLToPath( + new URL("../../cli/App.tsx", import.meta.url), + ); + const source = readFileSync(appPath, "utf-8"); + + expect(source).not.toContain("MAX_STATIC_ITEMS_ON_RESIZE"); + }); + + test("clearAndRemount redraws without mutating staticItems", () => { + const appPath = fileURLToPath( + new URL("../../cli/App.tsx", import.meta.url), + ); + const source = readFileSync(appPath, "utf-8"); + + const anchor = "const clearAndRemount = useCallback("; + const start = source.indexOf(anchor); + expect(start).toBeGreaterThanOrEqual(0); + + const end = source.indexOf( + "const scheduleResizeClear = useCallback(", + start, + ); + expect(end).toBeGreaterThan(start); + + const block = source.slice(start, end); + expect(block).toContain("setStaticRenderEpoch((epoch) => epoch + 1);"); + expect(block).not.toContain("setStaticItems("); + }); +});