Skip to content

Commit be889de

Browse files
authored
🤖 fix: deflake Storybook ChatInput focus (#1138)
Deflakes Storybook App bash/chat/reviews stories by removing timing-based focus sleeps. - Refactors ChatInput workspace auto-focus from setTimeout(100) to bounded requestAnimationFrame retries. - Exposes `data-autofocus-state="pending|done"` on `[data-component="ChatInputSection"]` so stories can wait deterministically. - Stops auto-focus attempts early if another element outside ChatInput has focus (avoid fighting user/modals). - Updates stories to `waitFor` auto-focus completion instead of `setTimeout(150)`. Validation: - make static-check - make storybook-build - make storybook (background) + make test-storybook --- _Generated with `mux` • Model: `unknown` • Thinking: `unknown`_
1 parent 6fcca8b commit be889de

File tree

5 files changed

+154
-155
lines changed

5 files changed

+154
-155
lines changed

.storybook/main.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ const config: StorybookConfig = {
1919
// src/version.ts in the Chromatic CI workflow, not via alias here
2020
},
2121
},
22+
// Prevent Vite from discovering new deps mid-test and forcing a full reload (test-storybook
23+
// interprets reloads as navigations and flakes). Keep this list minimal.
24+
optimizeDeps: {
25+
include: ["@radix-ui/react-checkbox"],
26+
},
2227
});
2328
},
2429
};

0 commit comments

Comments
 (0)