Commit 939ad6a
committed
fix: use useLayoutEffect for initial scroll to fix Chromatic snapshots
The scroll-to-bottom when workspace loads was using useEffect with
requestAnimationFrame, which runs asynchronously after browser paint.
Chromatic could capture the snapshot before scroll completed.
Switch to useLayoutEffect which runs synchronously after DOM mutations
but before paint, ensuring scroll happens before Chromatic captures.
This also removes the need for the RAF wrapper since useLayoutEffect
already guarantees DOM is ready.1 parent 1fb531e commit 939ad6a
1 file changed
+5
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
266 | 268 | | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
| 269 | + | |
271 | 270 | | |
272 | 271 | | |
273 | 272 | | |
| |||
0 commit comments