perf(webui): virtualize the log viewer row list (#185)
The logs page rendered every filtered row, so a full 2000-line view mounted ~10k DOM nodes and cost ~66ms of layout per commit. Switch to a virtualized list (@tanstack/react-virtual) that mounts only the visible window plus a small overscan — a few dozen nodes regardless of how many lines the view holds. Rows are dynamically measured (measureElement) so wrap mode's variable-height lines need no fixed row-height assumption; the size cache is keyed by row id so the maxLines front-drop doesn't mis-attribute heights across the index shift. The column header moved just outside the scroll viewport so the virtual list is the sole scroll content (no sticky-offset math). Auto-scroll now follows the tail via scrollToIndex with a next-frame re-pin (freshly-appended rows carry the size estimate until measured, which otherwise left wrap-mode tails short), and re-runs on filter/level/wrap/maxLines changes, not just new logs. ScrollArea gained an optional viewportRef so the virtualizer can drive off the real Radix scroll element. The per-row entrance fade is dropped (rows mount/unmount on scroll); divide-y became a per-row border.
This commit is contained in:
4 files changed
+126
-30
No files matched your search
@@ -20,6 +20,7 @@
|
||||
"@radix-ui/react-slot": "^1.1.3",
|
||||
"@radix-ui/react-tooltip": "^1.1.9",
|
||||
"@tanstack/react-router": "^1.169.2",
|
||||
"@tanstack/react-virtual": "^3.14.5",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"gridstack": "^12.6.0",
|
||||
|
||||
Reference in new issue
Block a user