From ae147813682a80a284eb81513ef0de7b0714ac98 Mon Sep 17 00:00:00 2001 From: harry-harish <22562634+harry-harish@users.noreply.github.com> Date: Thu, 9 Jul 2026 16:58:14 +0530 Subject: [PATCH] feat(todomvc-demo): add ?bug=1 reproducible bug for the connector case study An opt-in, unit-tested TypeError (Sort by priority on unmigrated data), gated behind ?bug=1 so the default demo is unaffected. Backs the peek Slack-connector case study's reproducible read-path scenario. Co-Authored-By: Claude Opus 4.8 Signed-off-by: harry-harish <22562634+harry-harish@users.noreply.github.com> --- apps/peek-todomvc-demo/package.json | 6 +- apps/peek-todomvc-demo/src/App.tsx | 15 +++ .../peek-todomvc-demo/src/lib/bugMode.test.ts | 16 ++++ apps/peek-todomvc-demo/src/lib/bugMode.ts | 8 ++ .../src/lib/sortByPriority.test.ts | 16 ++++ .../src/lib/sortByPriority.ts | 20 ++++ apps/peek-todomvc-demo/vitest.config.ts | 8 ++ pnpm-lock.yaml | 91 +++++++++++++++++++ 8 files changed, 178 insertions(+), 2 deletions(-) create mode 100644 apps/peek-todomvc-demo/src/lib/bugMode.test.ts create mode 100644 apps/peek-todomvc-demo/src/lib/bugMode.ts create mode 100644 apps/peek-todomvc-demo/src/lib/sortByPriority.test.ts create mode 100644 apps/peek-todomvc-demo/src/lib/sortByPriority.ts create mode 100644 apps/peek-todomvc-demo/vitest.config.ts diff --git a/apps/peek-todomvc-demo/package.json b/apps/peek-todomvc-demo/package.json index 4acdcc8d..84aaf4af 100644 --- a/apps/peek-todomvc-demo/package.json +++ b/apps/peek-todomvc-demo/package.json @@ -8,7 +8,8 @@ "scripts": { "dev": "vite", "build": "tsc -b && vite build", - "preview": "vite preview" + "preview": "vite preview", + "test": "vitest run" }, "dependencies": { "clsx": "^2.1.1", @@ -26,6 +27,7 @@ "@vitejs/plugin-react": "^6.0.1", "tailwindcss": "^4.3.1", "typescript": "~6.0.3", - "vite": "^8.0.12" + "vite": "^8.0.12", + "vitest": "^3.2.7" } } diff --git a/apps/peek-todomvc-demo/src/App.tsx b/apps/peek-todomvc-demo/src/App.tsx index f6009be9..1a146cf3 100644 --- a/apps/peek-todomvc-demo/src/App.tsx +++ b/apps/peek-todomvc-demo/src/App.tsx @@ -6,11 +6,14 @@ import { ThemeToggle } from './components/ThemeToggle' import { TodoList } from './components/TodoList' import { useTheme } from './hooks/useTheme' import { useTodos } from './hooks/useTodos' +import { isBugMode } from './lib/bugMode' +import { sortByPriority } from './lib/sortByPriority' function App() { const todos = useTodos() const { theme, toggle } = useTheme() const inputRef = useRef(null) + const bugMode = isBugMode(window.location.search) // Keyboard shortcuts: "/" focuses the input, 1/2/3 switch filters. useEffect(() => { @@ -75,6 +78,18 @@ function App() { onClearCompleted={todos.clearCompleted} /> )} + {bugMode && todos.todos.length > 0 && ( +
+ +
+ )}