You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I attempted to replicate the theme selection code that's in the documentation. That all works.
When I change values I can see they are written to local storage as expected. But if I navigate to another page (like home/counter/etc.), those values are lost and local storage still has a 'theme' entry but the values are null. They are being overwritten. As expected, if I close the browser while still on my theme selection page, and then restart the app, the values are there and set just fine. They are just overwritten on local navigation. I'm missing something obvious, but I can't figure out what.
I did notice that if, in App.razor I change this: <FluentDesignTheme StorageName="theme" />
to this: <FluentDesignTheme />
it stops overwriting, but none of the other pages are updated with the theme properties.
What am I missing? Thanks in advance.
<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8" /><metaname="viewport" content="width=device-width, initial-scale=1.0" /><basehref="/" /><linkrel="stylesheet" href="app.css" /><linkrel="stylesheet" href="BlazorAuthFluent.styles.css" /><linkrel="icon" type="image/x-icon" href="favicon.ico" /><HeadOutlet/></head><body><Routes/><scriptsrc="_framework/blazor.web.js"></script><!-- This line is supposed to retrieve the last stored theme from local storage and set the values before anything happens to prevent the 'flash' during the delay when the app is first visited. --><scriptsrc="_content/Microsoft.FluentUI.AspNetCore.Components/js/loading-theme.js" type="text/javascript"></script><loading-themestorage-name="theme"></loading-theme><!-- This line retrieves the last saved theme from local storage, key of 'theme' and then provides it to the entire app --><FluentDesignThemeStorageName="theme" /></body></html>
And here's the Razor code, which is almost an exact copy of the sample:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Not really sure what I'm doing wrong.
I attempted to replicate the theme selection code that's in the documentation. That all works.
When I change values I can see they are written to local storage as expected. But if I navigate to another page (like home/counter/etc.), those values are lost and local storage still has a 'theme' entry but the values are null. They are being overwritten. As expected, if I close the browser while still on my theme selection page, and then restart the app, the values are there and set just fine. They are just overwritten on local navigation. I'm missing something obvious, but I can't figure out what.
I did notice that if, in
App.razor
I change this:<FluentDesignTheme StorageName="theme" />
to this:
<FluentDesignTheme />
it stops overwriting, but none of the other pages are updated with the theme properties.
What am I missing? Thanks in advance.
And here's the Razor code, which is almost an exact copy of the sample:
Beta Was this translation helpful? Give feedback.
All reactions