79305574

Date: 2024-12-24 12:24:05
Score: 1.5
Natty:
Report link

It sounds like you're facing an issue where OnInitializedAsync is called twice when you directly hit the URL in the browser, but only once when navigating using a link. This is likely due to how the component is being instantiated in both scenarios, particularly with regard to how Blazor handles page navigation and re-renders.

In Blazor, when you navigate to a page via a URL directly (e.g., you refresh the page or type the URL directly into the browser), Blazor may re-initialize the component multiple times due to a few potential causes, such as component caching, re-rendering behavior, or how OnInitializedAsync is handled in different lifecycle phases.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: user28918983