From 8c8bb94e0fb4599a95eac37056db1ba8c2fe5476 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 28 Oct 2021 08:18:52 -0400 Subject: [PATCH] simplify fix Signed-off-by: Sebastian Malton --- .../+namespaces/namespace-select-filter.tsx | 5 ++++- .../components/+namespaces/namespace.store.ts | 12 +----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/renderer/components/+namespaces/namespace-select-filter.tsx b/src/renderer/components/+namespaces/namespace-select-filter.tsx index 27f3ac959f..436f0a8a80 100644 --- a/src/renderer/components/+namespaces/namespace-select-filter.tsx +++ b/src/renderer/components/+namespaces/namespace-select-filter.tsx @@ -121,7 +121,10 @@ export class NamespaceSelectFilter extends React.Component { namespaceStore.toggleSingle(namespace); } } else { - namespaceStore.selectAll(); + /** + * WARNING: only ever call this method with `false` as an argument + */ + namespaceStore.toggleAll(false); } }; diff --git a/src/renderer/components/+namespaces/namespace.store.ts b/src/renderer/components/+namespaces/namespace.store.ts index 7eb9fa2256..54f98702fc 100644 --- a/src/renderer/components/+namespaces/namespace.store.ts +++ b/src/renderer/components/+namespaces/namespace.store.ts @@ -149,7 +149,7 @@ export class NamespaceStore extends KubeObjectStore { } @computed get hasAllContexts(): boolean { - return this.contextNamespaces.length === this.allowedNamespaces.length; + return this.selectedNamespaces.length === this.allowedNamespaces.length; } @action @@ -167,18 +167,8 @@ export class NamespaceStore extends KubeObjectStore { this.selectNamespaces(namespace); } - @action - selectAll() { - this.selectNamespaces([]); // Empty array means "all" - } - - /** - * @deprecated This function is broken, `showAll` is opposite of what - */ @action toggleAll(showAll?: boolean) { - console.warn("NamespaceStore.toggleAll is deprecated. Use selectAll"); - if (typeof showAll === "boolean") { if (showAll) { this.selectNamespaces(this.allowedNamespaces);