Commit e007213
committed
perf: skip off-screen ai-msg layout with content-visibility
Toggling the sidebar off/on with a large AI chat history (>1k messages,
>10k DOM nodes) causes ~750ms of synchronous reflow on show, because
`display: none` drops the layout object and Chromium rebuilds it from
scratch. Adding `content-visibility: auto` lets the browser skip layout
and paint for messages that are far off-screen; `contain-intrinsic-size`
supplies a height estimate so scroll geometry stays stable.
Measured on a 1098-message session: show-freeze dropped from ~752ms to
~89ms (~8.5x). Progressive enhancement — browsers without support just
ignore the property.1 parent 6237e5b commit e007213
1 file changed
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
273 | 278 | | |
274 | 279 | | |
275 | 280 | | |
| |||
0 commit comments