@topconsultnpm/sdkui-react 6.20.0-dev2.32 → 6.20.0-dev2.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/helper/SDKUI_Globals.js +16 -0
- package/package.json +1 -1
|
@@ -35,6 +35,15 @@ export class UserSettings {
|
|
|
35
35
|
// Merge loaded settings with default settings
|
|
36
36
|
const defaultSettings = new UserSettings(true);
|
|
37
37
|
const settings = Object.assign(defaultSettings, loadedSettings);
|
|
38
|
+
// Ensure devSettings is properly initialized
|
|
39
|
+
if (settings.devSettings) {
|
|
40
|
+
// Ensure all devSettings properties exist
|
|
41
|
+
const defaultDevSettings = new DevSettings();
|
|
42
|
+
settings.devSettings = Object.assign(defaultDevSettings, settings.devSettings);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
settings.devSettings = new DevSettings();
|
|
46
|
+
}
|
|
38
47
|
// Ensure userID and archiveID are set
|
|
39
48
|
settings.userID = userID;
|
|
40
49
|
settings.archiveID = archiveID;
|
|
@@ -52,8 +61,15 @@ export class UserSettings {
|
|
|
52
61
|
if (!settings.userID || !settings.archiveID) {
|
|
53
62
|
throw new Error('User ID and Archive ID are required to save settings.');
|
|
54
63
|
}
|
|
64
|
+
// Properties that should always be saved, even if they match defaults
|
|
65
|
+
const alwaysSaveProperties = new Set(['userID', 'archiveID', 'devSettings']);
|
|
55
66
|
const defaultSettings = new UserSettings(true);
|
|
56
67
|
const filteredSettings = Object.fromEntries(Object.entries(settings).filter(([key, value]) => {
|
|
68
|
+
// Always save certain properties
|
|
69
|
+
if (alwaysSaveProperties.has(key)) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
// For other properties, only save if different from default
|
|
57
73
|
const defaultValue = defaultSettings[key];
|
|
58
74
|
return JSON.stringify(value) !== JSON.stringify(defaultValue);
|
|
59
75
|
}));
|