Commit 57608fa
authored
🤖 fix: eliminate chat textarea race condition on initial render (#958)
The chat input textarea could appear too large on initial app launch,
then collapse to correct size when text was entered.
**Root cause:** The previous fix used `useLayoutEffect` but still relied
on measuring `scrollHeight` after setting `height: auto`. For an empty
textarea, this measurement could return incorrect values before the flex
container layout had settled.
**Fix:** Skip `scrollHeight` measurement entirely when the textarea is
empty or whitespace-only. Instead, clear the inline height style and let
the CSS `min-h-8` (32px) handle sizing. This is deterministic and avoids
the race condition.
Also unified height management: ChatInput no longer hardcodes `36px`
when clearing input - it clears the inline style to let VimTextArea's
CSS take over, ensuring consistent behavior.
---
_Generated with `mux`_1 parent f9a85a2 commit 57608fa
2 files changed
+21
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
| 644 | + | |
| 645 | + | |
644 | 646 | | |
645 | | - | |
| 647 | + | |
646 | 648 | | |
647 | 649 | | |
648 | 650 | | |
| |||
661 | 663 | | |
662 | 664 | | |
663 | 665 | | |
664 | | - | |
| 666 | + | |
665 | 667 | | |
666 | 668 | | |
667 | 669 | | |
| |||
676 | 678 | | |
677 | 679 | | |
678 | 680 | | |
679 | | - | |
| 681 | + | |
680 | 682 | | |
681 | 683 | | |
682 | 684 | | |
| |||
994 | 996 | | |
995 | 997 | | |
996 | 998 | | |
997 | | - | |
| 999 | + | |
998 | 1000 | | |
999 | | - | |
| 1001 | + | |
1000 | 1002 | | |
1001 | 1003 | | |
1002 | 1004 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
89 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
90 | 101 | | |
91 | 102 | | |
92 | | - | |
93 | 103 | | |
94 | 104 | | |
95 | 105 | | |
| |||
0 commit comments