Skip to content

Styles are not loaded on Stream Rendering - FluentUI Template #1362

Answered by vnbaaij
Verfranc asked this question in Q&A
Discussion options

You must be logged in to vote

It wasn't know yet, but it is now 😉!

What happens is that the web components script (that loads the styling) is called after lazorhas started and that isn't until the OnInitializedAsync is done. There is nothing we can do about that.
What you can do is add the following in your App.razor after the <Routes /> component:

<script src="_content/Microsoft.FluentUI.AspNetCore.Components/Microsoft.FluentUI.AspNetCore.Components.lib.module.js" type="module" async></script>

That way you are basically jumpstarting the web components script yourself ahead of Blazor doing it. JavaScript handles the loading of the script twice perfectly fine.
There will still be a flash but it will at least be much s…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Verfranc
Comment options

Answer selected by Verfranc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants