Executing an asynchronous operation with navigation
In modern web applications, executing common logic during navigation can be crucial for maintaining a seamless user experience and gathering valuable insights. You can implement navigation event logging and achieve a better understanding of user behavior, identify the most frequently used features, and improve them accordingly. You can also implement periodic security checks and refresh a user’s access token seamlessly.
Let’s log all navigation requests inside the application to understand better which features users use the most so that you can prioritize them.
Getting ready
We will work inside the Routes
component, which you must already have, as it’s an integral part of the Blazor application. No preparation is required in this recipe.
How to do it…
Follow these instructions to trigger an operation on all navigation inside the app:
- Navigate to the
Routes
component and inject a...