chanan / BlazorStyled

CSS in Blazor Components
https://blazorstyled.io
The Unlicense
191 stars 19 forks source link

Initialized issue #99

Open imtrobin opened 4 years ago

imtrobin commented 4 years ago

Hi, I have a issue using BlazorStyled for themeng, I described in more detail here

https://stackoverflow.com/questions/62294319/blazor-two-js-interop-which-depend-on-each-other

The issue is SetThemeValueAsync is running a JS interop, and has delay. The SetThemeValue is just wrapping Task, and does not block.

Is there another way for it to be setup?

chanan commented 4 years ago

I suppose the theme values could be saved in c# and later transferred to JS.

Let me look at your stack overflow and see what the issue is though. Can’t get to it tonight but I will try to look tomorrow.

sanchez commented 3 years ago

I have encountered the same issue, I was able to work around it by disabling ServerPrerender and changing from using OnInitialized to OnInitializedAsync, finally make sure to call the base OnInitializedAsync first before you set your theme values