Skip to content

Commit aa18dd2

Browse files
committed
🤖 fix: wait for post-highlighting scroll RAF in CodeBlocks story
The CodeBlocks story was flaky because after Shiki highlighting completes, code block heights change which triggers the ResizeObserver in useAutoScroll to schedule a coalesced RAF scroll. Chromatic could capture the snapshot before this RAF completed. Add a double-RAF wait after verifying highlighting is done, matching the pattern used in useAutoScroll.performAutoScroll() and the expandAllBashTools helper. --- _Generated with `mux` • Model: `anthropic:claude-opus-4-5` • Thinking: `high`_
1 parent bb0c0b3 commit aa18dd2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/browser/stories/App.markdown.stories.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ export const CodeBlocks: AppStory = {
262262
{ timeout: 5000 }
263263
);
264264

265+
// Highlighting changes code block height, triggering ResizeObserver → coalesced RAF scroll.
266+
// Wait 2 RAFs: one for the coalesced scroll to fire, one for layout to settle.
267+
await new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)));
268+
265269
const url = "https://github.com/coder/mux/pull/new/chat-autocomplete-b24r";
266270
const container = await waitFor(
267271
() => {

0 commit comments

Comments
 (0)