Skip to content

Commit 7cf5046

Browse files
xflordJohaney-s
authored andcommitted
fix: fixed a bug that caused properties of object in instanceConfig that weren't in the same object in defaultConfig to not load at all
* this bug caused that if instanceConfig contained password_help for a namespace that wasn't in the defaultConfig password_help, the password_help for that namespace wouldn't load (and would fall back to default).
1 parent 89fe381 commit 7cf5046

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

libs/perun/services/src/lib/store.service.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,14 @@ export class StoreService {
8989
value: T[K],
9090
defaultValue: T[K]
9191
): T[K] {
92-
if (
93-
typeof value === 'object' &&
94-
!Array.isArray(value) &&
95-
value !== null &&
96-
value !== undefined
97-
) {
92+
if (value === null || value === undefined) {
93+
return defaultValue;
94+
}
95+
if (typeof value === 'object' && !Array.isArray(value)) {
9896
for (const key of Object.keys(defaultValue)) {
99-
defaultValue[key] = this.addMissingValuesToProperty(
100-
value[key] as T[K],
101-
defaultValue[key] as T[K]
102-
);
97+
value[key] = this.addMissingValuesToProperty(value[key] as T[K], defaultValue[key] as T[K]);
10398
}
104-
} else if (value !== null && value !== undefined) {
105-
return value;
10699
}
107-
return defaultValue;
100+
return value;
108101
}
109102
}

0 commit comments

Comments
 (0)