Menu

Let the Router Own the Next Paint
📰

Let the Router Own the Next Paint

DEV Community: blazor·Ivan Rossouw·3 days ago
#cdqxOqwx
#devtoblazor#devto#dev#destination#address
Reading 0:00
15s threshold

Navigation bugs are often judged by their final state. Did the correct page appear? Did the authorization check pass? Did the URL settle on the expected address?

Those questions matter, but they can miss the frame that users actually notice.

In a recent component-based web fix, the destination page was correct. The address was correct. The authorization result was correct. Yet, between the address change and the destination render, the departing page painted once more. Because the framework also applied its scroll reset during that interval, users briefly saw stale content at the top of the viewport before the new page arrived.

The repair produced a useful general lesson: after an address change, the router should own the next visible paint.

A correct destination can still have a wrong journey

An end-state test sees a simple sequence:

start on page A;

navigate to page B;

assert that page B is visible.

The browser may have seen something richer:

page A is visible at the user’s current scroll…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.