Commit badf088
committed
🤖 fix: use useLayoutEffect for chat input auto-resize
The chat input could appear way too big vertically on initial app launch,
then collapse to correct size when text was entered or window was resized.
Root cause: useEffect runs asynchronously after paint, so the initial
scrollHeight measurement could happen before layout settled, resulting
in an incorrect (too large) height that persisted until next value change.
Fix: Switch to useLayoutEffect which runs synchronously after DOM mutations
but before the browser paints, ensuring accurate initial height measurement.1 parent 5874155 commit badf088
1 file changed
+6
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
| 72 | + | |
70 | 73 | | |
71 | 74 | | |
| 75 | + | |
72 | 76 | | |
73 | 77 | | |
74 | 78 | | |
| |||
0 commit comments