Skip to content

fix: [Local storage for theme not being set] in [FluentDesignTheme] #2885

@Nikkoro

Description

@Nikkoro

🐛 Bug Report

Theme is not saved in localstorage when using StorageName

💻 Repro or Code Sample

Add to App.razor or main layout:
<FluentDesignTheme Mode="DesignThemeModes.Default" OfficeColor="OfficeColor.Teams" StorageName="theme" />

🤔 Expected Behavior

Theme should be saved in localstorage without need to switch it manually for the first time

😯 Current Behavior

When you set a theme like this:
<FluentDesignTheme Mode="DesignThemeModes.Default" OfficeColor="OfficeColor.Teams" StorageName="theme" />
it's not being added to localstorage untill you switch the theme.

Right now, the only way to save the theme to localstorage is to bind values and switch the theme for example using some button, only then the theme is added to localstorage.

<FluentDesignTheme @bind-Mode="@Mode" @bind-OfficeColor="@ThemeColor" StorageName="theme"

20241030-0905-15.9752797.mp4

💁 Possible Solution

Not sure

🔦 Context

I want to save the theme in localstorage with values mode: null and primaryColor: Teams, so it will switch according to user settings. Right now sometimes the theme is being set wrong and having the values in localstorage could help.

🌍 Your Environment

Windows 11, Edge, FluentUI v4.10.3, .NET 8.0.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNew issue. Needs to be looked at

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions