(blankSettings);
useEffect(() => {
SettingsManager.get().then((s) => {
setSettings(s);
setInitialSettings(s);
});
- });
+ }, []);
+
+ if (settings === null || initialSettings === null) {
+ return ;
+ }
const customFields = {
BooleanField: InspectorBoolean
@@ -78,11 +83,9 @@ function SettingsWindow() {
await emit("nh://settings-changed", settings);
const themeChanged = settings.theme !== initialSettings.theme;
- const alwaysUseTextEditorChanged =
- settings.alwaysUseTextEditor !== initialSettings.alwaysUseTextEditor;
const schemaBranchChanged = settings.schemaBranch !== initialSettings.schemaBranch;
- if ([themeChanged, alwaysUseTextEditorChanged, schemaBranchChanged].includes(true)) {
+ if ([themeChanged, schemaBranchChanged].includes(true)) {
const result = await ask(
"You need to reload the app to apply these changes. Do you want to reload now? (Any unsaved changes will be lost!)",
{
@@ -106,7 +109,7 @@ function SettingsWindow() {
);
if (result) {
await SettingsManager.reset();
- setSettings(await SettingsManager.get());
+ setSettings(initialSettings);
close();
await emit("nh://reload");
}
@@ -118,7 +121,10 @@ function SettingsWindow() {