-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Each time the host page rerenders (e.g., for reasons unrelated to navigation), it will call the router's SetParametersAsync
, which in turn calls Refresh
which then calls _renderHandle.Render(Found(routeData));
. It does this even if a lazy-load is currently in progress, which means it might throw if the route relies on assemblies not yet loaded.
At minimum, we could address this by making the router a bit more stateful. It could keep track of whether a load is in progress, and if so, render the Navigating
fragment if there is one, or skip rendering if not.
A more sophisticated solution might involve changing the Update: Filed #24215 to track this separate aspect of it.OnNavigateAsync
callback to be an EventCallback<T>
and letting the event system be responsible for rerendering during navigation. This would have some benefits like auto-rendering the host page on navigation just like any other event handler. It's a bit tricky to wrap one eventcallback inside another but I think it's technically possible because we're inside the M.A.Components
project and hence can freely read the internal properties of EventCallback<T>
.