Skip to content

Commit

Permalink
fix(ui): Fix-up local storage namespaces. Fixes #6109 (#6144)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexec committed Jun 15, 2021
1 parent fd6ac08 commit 963bed3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ui/src/app/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,14 @@ export const Utils = {
},

get managedNamespace() {
return localStorage.getItem(managedNamespaceKey);
return this.fixLocalStorageString(localStorage.getItem(managedNamespaceKey));
},

fixLocalStorageString(x: string): string {
// empty string is valid, so we cannot use `truthy`
if (x !== null && x !== 'null' && x !== 'undefined') {
return x;
}
},

onNamespaceChange(value: string) {
Expand All @@ -99,7 +106,7 @@ export const Utils = {

get currentNamespace() {
// we always prefer the managed namespace
return this.managedNamespace || localStorage.getItem(currentNamespaceKey);
return this.managedNamespace || this.fixLocalStorageString(localStorage.getItem(currentNamespaceKey));
},

// return a namespace, favoring managed namespace when set
Expand Down

0 comments on commit 963bed3

Please sign in to comment.