TryMudBlazor
TryMudBlazor copied to clipboard
Editor showing default theme on first load
When you load the UserPage for the first time the editor will be themed default and the rest will be in vs-dark mode. I tried the following change:
create: function (id, value, language) {
if (!id) { return; }
let _theme = "vs-dark"; // was "default"
let userPreferences = localStorage.getItem("userPreferences");
if (userPreferences) {
const userPrefer
encesJSON = JSON.parse(userPreferences);
if (userPreferencesJSON.hasOwnProperty("DarkTheme") && userPreferencesJSON.DarkTheme) {
_theme = "vs-dark";
}
Which appears to fix it at first until you refresh the page when you have the theme set to default. The editor shows in vs-dark mode. The problem appears to be a failure to load the setting properly when you refresh or when there's no userPreferences set.