Filter Toggle Causes 180 ms Interaction Delay and Layout Shift in Catalog Pages

A design-system pull request added a compact-density toggle to a catalog filter bar, but it caused problems on production pages despite working well in local testing. Telemetry showed the 75th-percentile Interaction to Next Paint on mid-tier Android devices rising from 38 ms to 180 ms, while Cumulative Layout Shift spiked to 0.14 as the sticky toolbar moved on each click. Investigation traced the cause to a root CSS variable update, an unstable context value object, and a layout effect that interleaved reads and writes, forcing repeated synchronous layouts. A React.memo hotfix did not help in production. The fix involved wrapping the grid filter update in a transition so the pressed chip could paint before the heavier reconciliation completed.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in