The problem

A shopper who is not signed in taps the heart on a product and a login panel slides in. On a mid-range phone profile that tap took 184 ms on category and product pages and 240 ms on Home.

What I found

The working assumption was that mounting the panel was slow. Measuring it said otherwise: the panel mounts 12 components. The cost was that 806 components elsewhere on the page re-rendered, twice.

The cause was a shared hook that re-ran every component using it whenever anything in the account store changed, and opening the panel changes that store in two steps. Every product card, the header and the footer were listening to data they never displayed.

What I changed

The hooks now re-render a component only when a field it actually reads has changed. The analytics event for the panel is sent after the next paint instead of before it. The function that opens the panel is untouched.

The fix lives in the account team's codebase, not in the pages that showed the symptom, so every page that uses the panel gets it.

The version I threw away

My first version deferred opening the panel by a frame. It scored 40 ms. It also made no difference to the shopper, who waited exactly as long to see the panel; the metric had simply stopped counting that wait.

So the rule for this work became: when a result is deferred, compare the time to the frame that shows the result, in every version. By that measure the honest fix is 184 to 112 ms, and that is the one that shipped.