Skip to content

Commit 4f3151b

Browse files
authored
Only write data-theme when mode is changed (#4105)
1 parent c4a900d commit 4f3151b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/Core/Components/DesignSystemProvider/FluentDesignTheme.razor.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ export function addThemeChangeEvent(dotNetHelper, id) {
33

44
if (element) {
55
element.addEventListener("onchange", (e) => {
6-
UpdateBodyDataSetTheme(e.detail.newValue);
6+
if (e.detail.name === "mode") {
7+
UpdateBodyDataSetTheme(e.detail.newValue);
8+
}
79
try {
810
// setTimeout: https://github.com/dotnet/aspnetcore/issues/26809
911
setTimeout(() => {
@@ -28,7 +30,7 @@ export function addThemeChangeEvent(dotNetHelper, id) {
2830
ClearLocalStorage(id);
2931
console.error(`FluentDesignTheme: failing to load theme from localStorage.`, error);
3032
}
31-
33+
3234
}
3335

3436
return null;

0 commit comments

Comments
 (0)