Commit d1c0109
authored
🤖 refactor: trim chat transcript scroll cleanup (#3210)
## Summary
Follow-up cleanup after #3201: trims maintenance-only code in the chat
transcript bottom-lock and bash auto-expand paths while preserving the
validated behavior. After a 4-lane sub-agent review, this PR also
consolidates duplicated scroll-metric test scaffolding and removes a few
small dead/indirect code paths.
## Background
#3201 stabilized transcript bottom ownership and bash row expansion.
This PR keeps that behavior but reduces surface area in the related code
paths. Cleanup candidates were split across sub-agent lanes for
auto-scroll, bash/tool rows, ChatPane/LayoutStack, and related renderer
test helpers; the accepted low-risk findings were consolidated here.
## Implementation
- Replaces the bash auto-expand hook's raw latest-bash id input with a
direct `hasReplacementStreamingBash` boolean.
- Consolidates bash auto-expand timer cleanup into the layout effect and
removes the separate unmount-only effect.
- Simplifies local Bash row derived state for output/background results.
- Removes the unused `observedHeightRef` writes from `LayoutStackLane`.
- Drops an unused auto-scroll distance helper.
- Removes dead `todoCount` prop plumbing from `ChatInputPane`.
- Shares the happy-dom scroll-metric shim between hook and integration
tests.
- Reuses the scroll-metric helper in the bottom-layout integration test
and makes the viewport-resize case actually shrink the viewport.
## Validation
- `make fmt`
- `bun test src/browser/hooks/useAutoScroll.test.tsx`
- `bun test
src/browser/features/Tools/Shared/useBashAutoExpand.test.tsx`
- `bun test src/browser/components/ChatPane/LayoutStackLane.test.tsx`
- `TEST_INTEGRATION=1 bun x jest tests/ui/chat/bottomLayoutShift.test.ts
--runInBand --silent`
- `make static-check`
## Risks
Low. The production changes are small refactors in already-covered
paths. The most behavior-adjacent changes are the bash auto-expand hook
API and shared test scroll shim, both covered by targeted tests plus
`make static-check`.
---
_Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `xhigh` •
Cost: `$386.28`_
<!-- mux-attribution: model=openai:gpt-5.5 thinking=xhigh costs=386.28
-->1 parent ba13455 commit d1c0109
9 files changed
Lines changed: 123 additions & 221 deletions
File tree
- src/browser
- components/ChatPane
- features/Tools
- hooks
- tests/ui
- chat
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | | - | |
288 | | - | |
| 287 | + | |
289 | 288 | | |
290 | 289 | | |
291 | 290 | | |
| |||
1025 | 1024 | | |
1026 | 1025 | | |
1027 | 1026 | | |
1028 | | - | |
1029 | 1027 | | |
1030 | 1028 | | |
1031 | 1029 | | |
| |||
1078 | 1076 | | |
1079 | 1077 | | |
1080 | 1078 | | |
1081 | | - | |
1082 | 1079 | | |
1083 | 1080 | | |
1084 | 1081 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
| |||
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
53 | | - | |
54 | 52 | | |
55 | 53 | | |
56 | 54 | | |
57 | 55 | | |
58 | 56 | | |
59 | | - | |
60 | | - | |
61 | 57 | | |
62 | 58 | | |
63 | 59 | | |
| |||
94 | 90 | | |
95 | 91 | | |
96 | 92 | | |
97 | | - | |
98 | 93 | | |
99 | 94 | | |
100 | 95 | | |
| |||
109 | 104 | | |
110 | 105 | | |
111 | 106 | | |
112 | | - | |
113 | 107 | | |
114 | 108 | | |
115 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| |||
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
97 | | - | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| |||
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
112 | | - | |
| 113 | + | |
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| |||
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
137 | | - | |
| 138 | + | |
138 | 139 | | |
139 | 140 | | |
140 | 141 | | |
| |||
311 | 312 | | |
312 | 313 | | |
313 | 314 | | |
314 | | - | |
| 315 | + | |
315 | 316 | | |
316 | 317 | | |
317 | 318 | | |
318 | 319 | | |
319 | | - | |
| 320 | + | |
320 | 321 | | |
321 | 322 | | |
322 | 323 | | |
| |||
Lines changed: 9 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | | - | |
| 11 | + | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | | - | |
22 | | - | |
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
27 | 24 | | |
28 | | - | |
29 | | - | |
30 | | - | |
| 25 | + | |
31 | 26 | | |
32 | 27 | | |
33 | 28 | | |
34 | | - | |
| 29 | + | |
35 | 30 | | |
36 | 31 | | |
37 | 32 | | |
38 | 33 | | |
39 | 34 | | |
40 | 35 | | |
41 | | - | |
| 36 | + | |
42 | 37 | | |
43 | 38 | | |
44 | 39 | | |
| |||
58 | 53 | | |
59 | 54 | | |
60 | 55 | | |
61 | | - | |
62 | 56 | | |
63 | 57 | | |
64 | 58 | | |
| |||
73 | 67 | | |
74 | 68 | | |
75 | 69 | | |
76 | | - | |
77 | 70 | | |
78 | 71 | | |
79 | 72 | | |
| |||
90 | 83 | | |
91 | 84 | | |
92 | 85 | | |
93 | | - | |
94 | 86 | | |
95 | 87 | | |
96 | 88 | | |
| |||
104 | 96 | | |
105 | 97 | | |
106 | 98 | | |
107 | | - | |
108 | 99 | | |
109 | 100 | | |
110 | 101 | | |
| |||
120 | 111 | | |
121 | 112 | | |
122 | 113 | | |
123 | | - | |
124 | 114 | | |
125 | 115 | | |
126 | 116 | | |
| |||
132 | 122 | | |
133 | 123 | | |
134 | 124 | | |
135 | | - | |
136 | 125 | | |
137 | 126 | | |
138 | 127 | | |
| |||
142 | 131 | | |
143 | 132 | | |
144 | 133 | | |
145 | | - | |
| 134 | + | |
146 | 135 | | |
147 | 136 | | |
148 | | - | |
| 137 | + | |
149 | 138 | | |
150 | 139 | | |
151 | 140 | | |
| |||
155 | 144 | | |
156 | 145 | | |
157 | 146 | | |
158 | | - | |
159 | 147 | | |
160 | 148 | | |
161 | 149 | | |
| |||
164 | 152 | | |
165 | 153 | | |
166 | 154 | | |
167 | | - | |
168 | | - | |
169 | | - | |
| 155 | + | |
| 156 | + | |
170 | 157 | | |
171 | 158 | | |
172 | | - | |
173 | 159 | | |
174 | 160 | | |
175 | 161 | | |
| |||
180 | 166 | | |
181 | 167 | | |
182 | 168 | | |
183 | | - | |
184 | 169 | | |
185 | 170 | | |
186 | 171 | | |
| |||
| 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 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
27 | 13 | | |
28 | 14 | | |
29 | 15 | | |
30 | | - | |
| 16 | + | |
31 | 17 | | |
32 | 18 | | |
33 | 19 | | |
| |||
37 | 23 | | |
38 | 24 | | |
39 | 25 | | |
40 | | - | |
| 26 | + | |
41 | 27 | | |
42 | 28 | | |
43 | 29 | | |
| |||
51 | 37 | | |
52 | 38 | | |
53 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
54 | 46 | | |
55 | 47 | | |
56 | 48 | | |
57 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
58 | 52 | | |
59 | 53 | | |
60 | 54 | | |
61 | 55 | | |
62 | 56 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | 57 | | |
67 | 58 | | |
68 | | - | |
| 59 | + | |
69 | 60 | | |
70 | 61 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
82 | 72 | | |
83 | 73 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 74 | + | |
| 75 | + | |
91 | 76 | | |
92 | 77 | | |
93 | 78 | | |
| 79 | + | |
94 | 80 | | |
95 | 81 | | |
96 | | - | |
| 82 | + | |
97 | 83 | | |
98 | 84 | | |
99 | 85 | | |
100 | 86 | | |
101 | 87 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | 88 | | |
0 commit comments