mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-12 10:45:54 +00:00
fix(Map): Fix problem with restoring settings on widgets
This commit is contained in:
@@ -64,7 +64,7 @@ export const ImportExport = () => {
|
|||||||
|
|
||||||
// INFO: WE NOT SUPPORT MIGRATIONS FOR OLD FILES AND Clipboard
|
// INFO: WE NOT SUPPORT MIGRATIONS FOR OLD FILES AND Clipboard
|
||||||
const parsed = parseMapUserSettings(text);
|
const parsed = parseMapUserSettings(text);
|
||||||
if (applySettings(applyMigrations(parsed))) {
|
if (applySettings(applyMigrations(parsed) || createDefaultStoredSettings())) {
|
||||||
toast.current?.show({
|
toast.current?.show({
|
||||||
severity: 'success',
|
severity: 'success',
|
||||||
summary: 'Import',
|
summary: 'Import',
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export const ServerSettings = () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
//INFO: INSTEAD CHECK WE WILL TRY TO APPLY MIGRATION
|
//INFO: INSTEAD CHECK WE WILL TRY TO APPLY MIGRATION
|
||||||
applySettings(applyMigrations(JSON.parse(res.default_settings)));
|
applySettings(applyMigrations(JSON.parse(res.default_settings)) || createDefaultStoredSettings());
|
||||||
callToastSuccess(toast.current, 'Settings synchronized successfully');
|
callToastSuccess(toast.current, 'Settings synchronized successfully');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
applySettings(createDefaultStoredSettings());
|
applySettings(createDefaultStoredSettings());
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export const useActualizeRemoteMapSettings = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
applySettings(applyMigrations(JSON.parse(res.default_settings)));
|
applySettings(applyMigrations(JSON.parse(res.default_settings) || createDefaultStoredSettings()));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
applySettings(createDefaultStoredSettings());
|
applySettings(createDefaultStoredSettings());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export const applyMigrations = (mapSettings: any) => {
|
|||||||
return { ...currentMapSettings, version: STORED_SETTINGS_VERSION, migratedFromOld: true };
|
return { ...currentMapSettings, version: STORED_SETTINGS_VERSION, migratedFromOld: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return currentMapSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cmVersion = currentMapSettings.version || 0;
|
const cmVersion = currentMapSettings.version || 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user