C#C
C#2y ago
SpReeD

✅ Blazor and Javascript loading

So, I have a main page and a separate adminpage. On navigating to the admin site it changes the layout to AdminLayout.razor which inherits from @inherits LayoutComponentBase. So far, so good, the adminpage inlcudes @layout AdminLayout and everything is displayed correctly.

The AdminLayout also has several JS includes at the end of
body
.
It seems that after first navigation those scripts aren't loaded, the behaviour is as followed:
  • Navigate to admin page
  • Click on a <a href="#"> that should expand a collapsed div, but it doesn't
  • Reload/Refresh the page after it's initial load and it works as expected
Switching the rendermode to Server and Server without prerender haven't helped here.
Navigating to the adminpage via NavigationManager, could this be an issue?
Was this page helpful?