Commit e139d7b
committed
fix: typing in ChatInput no longer causes unnecessary rerenders
This commit refactors the Chat component by removing unnecessary state management for input handling and streamlining the message submission process. The `setInput` state has been eliminated in favor of directly appending messages. Additionally, a new test suite for the ChatInput component has been introduced, covering rendering, message submission, and input behavior.
- Removed `input`, `handleInputChange`, and `handleSubmit` from Chat component.
- Updated message submission to use `append` directly.
- Added tests for ChatInput to ensure proper functionality and accessibility.
This refactor enhances code clarity and maintainability while ensuring the ChatInput component behaves as expected.1 parent cd5ea20 commit e139d7b
3 files changed
Lines changed: 78 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
824 | 824 | | |
825 | 825 | | |
826 | 826 | | |
827 | | - | |
828 | | - | |
829 | | - | |
830 | 827 | | |
831 | 828 | | |
832 | | - | |
| 829 | + | |
833 | 830 | | |
834 | 831 | | |
835 | 832 | | |
| |||
883 | 880 | | |
884 | 881 | | |
885 | 882 | | |
886 | | - | |
887 | | - | |
| 883 | + | |
888 | 884 | | |
889 | | - | |
| 885 | + | |
890 | 886 | | |
891 | 887 | | |
892 | 888 | | |
| |||
907 | 903 | | |
908 | 904 | | |
909 | 905 | | |
910 | | - | |
| 906 | + | |
911 | 907 | | |
912 | 908 | | |
913 | 909 | | |
914 | 910 | | |
915 | 911 | | |
916 | 912 | | |
917 | 913 | | |
918 | | - | |
| 914 | + | |
919 | 915 | | |
920 | 916 | | |
921 | 917 | | |
| |||
1167 | 1163 | | |
1168 | 1164 | | |
1169 | 1165 | | |
1170 | | - | |
1171 | | - | |
1172 | 1166 | | |
1173 | 1167 | | |
1174 | 1168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
17 | | - | |
18 | | - | |
19 | 15 | | |
20 | 16 | | |
21 | 17 | | |
| |||
28 | 24 | | |
29 | 25 | | |
30 | 26 | | |
31 | | - | |
32 | 27 | | |
33 | | - | |
34 | 28 | | |
35 | 29 | | |
36 | | - | |
| 30 | + | |
37 | 31 | | |
38 | | - | |
| 32 | + | |
39 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
40 | 37 | | |
41 | 38 | | |
42 | 39 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 40 | + | |
| 41 | + | |
48 | 42 | | |
49 | 43 | | |
50 | 44 | | |
51 | | - | |
52 | | - | |
| 45 | + | |
53 | 46 | | |
54 | 47 | | |
55 | | - | |
| 48 | + | |
56 | 49 | | |
57 | 50 | | |
58 | 51 | | |
| |||
64 | 57 | | |
65 | 58 | | |
66 | 59 | | |
67 | | - | |
68 | | - | |
| 60 | + | |
69 | 61 | | |
70 | 62 | | |
71 | 63 | | |
72 | 64 | | |
73 | 65 | | |
| 66 | + | |
74 | 67 | | |
75 | 68 | | |
76 | 69 | | |
77 | 70 | | |
78 | 71 | | |
79 | 72 | | |
80 | | - | |
| 73 | + | |
81 | 74 | | |
82 | | - | |
| 75 | + | |
| 76 | + | |
83 | 77 | | |
84 | 78 | | |
85 | 79 | | |
| |||
0 commit comments