Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@ export function addThemeChangeEvent(dotNetHelper, id) {
}
});

const theme = element.themeStorage.readLocalStorage()
return theme == null ? theme : JSON.stringify(theme);
try {
// This can fail when localStorage does not contain a valid JSON object
const theme = element.themeStorage.readLocalStorage()
return theme == null ? theme : JSON.stringify(theme);
} catch (error) {
ClearLocalStorage(id);
console.error(`FluentDesignTheme: failing to load theme from localStorage.`, error);
}

}

return null;
Expand Down