Commit 3afd882
committed
perf(ui): cut forced reflows in chat render path
Profiled the Control UI with Chrome DevTools tracing against a real-data
gateway: session-switch INP was 367ms with ForcedReflow insights on every
load and interaction trace.
- chat-thread: per-row stable Lit ref callbacks (keyed by row key) so the
virtualizer stops cache-sweeping and re-measuring every visible row on
every render; prune callbacks when rows leave the list
- chat-composer: stable textarea ref on per-pane state instead of an
inline arrow, so the textarea is re-measured only on attach or when the
draft changes programmatically, not on every chat render
- app-sidebar: coalesce scrollHeight/scrollTop reads from updated() into
one rAF per frame instead of a forced layout flush per render
After: INP 133-143ms on the same interaction sequence, no ForcedReflow
insight in load or interaction traces.1 parent 00eb33f commit 3afd882
3 files changed
Lines changed: 80 additions & 27 deletions
File tree
- ui/src
- components
- pages/chat/components
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
164 | 169 | | |
165 | 170 | | |
166 | 171 | | |
| |||
384 | 389 | | |
385 | 390 | | |
386 | 391 | | |
387 | | - | |
| 392 | + | |
388 | 393 | | |
389 | 394 | | |
390 | 395 | | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
391 | 412 | | |
392 | 413 | | |
393 | 414 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
164 | 169 | | |
165 | 170 | | |
166 | 171 | | |
| |||
178 | 183 | | |
179 | 184 | | |
180 | 185 | | |
| 186 | + | |
| 187 | + | |
181 | 188 | | |
182 | 189 | | |
183 | 190 | | |
| |||
1886 | 1893 | | |
1887 | 1894 | | |
1888 | 1895 | | |
1889 | | - | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
1890 | 1913 | | |
1891 | 1914 | | |
1892 | 1915 | | |
| |||
2142 | 2165 | | |
2143 | 2166 | | |
2144 | 2167 | | |
2145 | | - | |
| 2168 | + | |
2146 | 2169 | | |
2147 | 2170 | | |
2148 | 2171 | | |
2149 | 2172 | | |
2150 | 2173 | | |
2151 | | - | |
| 2174 | + | |
2152 | 2175 | | |
2153 | 2176 | | |
2154 | 2177 | | |
2155 | 2178 | | |
2156 | 2179 | | |
2157 | 2180 | | |
2158 | | - | |
| 2181 | + | |
2159 | 2182 | | |
2160 | 2183 | | |
2161 | 2184 | | |
| |||
2256 | 2279 | | |
2257 | 2280 | | |
2258 | 2281 | | |
2259 | | - | |
| 2282 | + | |
2260 | 2283 | | |
2261 | 2284 | | |
2262 | 2285 | | |
| |||
2290 | 2313 | | |
2291 | 2314 | | |
2292 | 2315 | | |
2293 | | - | |
2294 | | - | |
2295 | | - | |
2296 | | - | |
2297 | | - | |
2298 | | - | |
2299 | | - | |
2300 | | - | |
2301 | | - | |
2302 | | - | |
2303 | | - | |
| 2316 | + | |
2304 | 2317 | | |
2305 | 2318 | | |
2306 | 2319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
202 | 224 | | |
203 | 225 | | |
204 | 226 | | |
| |||
292 | 314 | | |
293 | 315 | | |
294 | 316 | | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
| 317 | + | |
302 | 318 | | |
303 | 319 | | |
304 | 320 | | |
| |||
324 | 340 | | |
325 | 341 | | |
326 | 342 | | |
327 | | - | |
328 | | - | |
329 | | - | |
| 343 | + | |
330 | 344 | | |
331 | 345 | | |
332 | 346 | | |
| |||
388 | 402 | | |
389 | 403 | | |
390 | 404 | | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
391 | 410 | | |
392 | 411 | | |
393 | 412 | | |
| |||
0 commit comments