You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P1] [bug] TruncatedCell ResizeObserver leak on frequent updates #417
[P1] [bug] TruncatedCell's ResizeObserver recreated on every value change — leak in tables with frequent updates
Context
TruncatedCell.tsx:23-39useEffect deps are [formatted, columnName, dataType]. For cells with frequently-changing values (e.g., SELECT NOW() polling, edit-mode keystrokes), the effect tears down and re-creates the ResizeObserver on every render.
Problem
Per docs/audits/results.md F22.
With 100 visible cells × 60 renders/sec, that's 6000 ResizeObserver instances/sec. GC pressure mounts; profile climbs to 100% CPU on idle scroll.
Files
src/components/grid/TruncatedCell.tsx:23-39
Repro (if applicable)
Static analysis only.
Expected
A 100-row SELECT NOW() polling every second stays at ~60% CPU on idle scroll, not climbing to 100%. ResizeObserver count stays bounded.
Proposed fix
Scope S. useMemo(() => formatted, [formatted]) on the formatted string; or pass value as the dep instead of formatted so the effect doesn't re-run when output is identical. Skip observer if column type is not long-text/blob/json.
Acceptance
ResizeObserver instances don't grow with render rate; CPU stays bounded.
Already fixed, in fdd8919 ("stop hijacking the wheel, and stop rebuilding observers", #542).
TruncatedCell.tsx:62-76 now constructs the ResizeObserver in an effect with an empty dependency list — one per mounted cell, for as long as it is mounted. columnName and dataType went too; neither has any bearing on whether text overflows its box.
The measurement the old effect was really doing still re-runs per value, as a separate layout read, because text can change without the box resizing.
Covered by describe("observer churn") in TruncatedCell.test.tsx: 25 value changes leave exactly one observer, and changing the column metadata leaves it alone too.
One correction to the issue: nothing leaked. The cleanup did disconnect each observer, so the cost was construction churn and the CPU it burnt, not unbounded growth.
Activity
fix(grid): stop hijacking the wheel, and stop rebuilding observers (#542
EVWorth commentedon Sep 11, 2026
Already fixed, in fdd8919 ("stop hijacking the wheel, and stop rebuilding observers", #542).
TruncatedCell.tsx:62-76 now constructs the
ResizeObserverin an effect with an empty dependency list — one per mounted cell, for as long as it is mounted.columnNameanddataTypewent too; neither has any bearing on whether text overflows its box.The measurement the old effect was really doing still re-runs per value, as a separate layout read, because text can change without the box resizing.
Covered by
describe("observer churn")inTruncatedCell.test.tsx: 25 value changes leave exactly one observer, and changing the column metadata leaves it alone too.One correction to the issue: nothing leaked. The cleanup did disconnect each observer, so the cost was construction churn and the CPU it burnt, not unbounded growth.