diff --git a/src/renderer/api/api-manager.ts b/src/renderer/api/api-manager.ts index 9682b53f37..90e63f692b 100644 --- a/src/renderer/api/api-manager.ts +++ b/src/renderer/api/api-manager.ts @@ -23,6 +23,12 @@ export class ApiManager { registerApi(apiBase: string, api: KubeApi) { if (!this.apis.has(apiBase)) { + this.stores.forEach((store) => { + if(store.api === api) { + this.stores.set(apiBase, store); + } + }); + this.apis.set(apiBase, api); } } @@ -43,14 +49,6 @@ export class ApiManager { } } - updateStoreKey(oldKey: string) { - const store = this.stores.get(oldKey); - - if (!store) return; - this.stores.delete(oldKey); - this.registerStore(store, [store.api]); - } - @action registerStore(store: KubeObjectStore, apis: KubeApi[] = [store.api]) { apis.forEach(api => { diff --git a/src/renderer/api/kube-api.ts b/src/renderer/api/kube-api.ts index cbe16bf3e6..6e26bf1bea 100644 --- a/src/renderer/api/kube-api.ts +++ b/src/renderer/api/kube-api.ts @@ -233,7 +233,6 @@ export class KubeApi { Object.defineProperty(this, "apiBase", { value: apiBase }); apiManager.registerApi(this.apiBase, this); - apiManager.updateStoreKey(this.objectConstructor.apiBase); } } }