1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Update store key after api's apiBase change

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
Lauri Nevala 2021-02-15 17:35:02 +02:00
parent 8d74f1c759
commit 3c78e2fce9
2 changed files with 12 additions and 1 deletions

View File

@ -43,6 +43,14 @@ 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 => {

View File

@ -229,8 +229,11 @@ export class KubeApi<T extends KubeObject = any> {
});
if (this.apiVersionPreferred) {
Object.defineProperty(this, "apiBase", { value: this.getUrl() });
const apiBase = this.getUrl();
Object.defineProperty(this, "apiBase", { value: apiBase });
apiManager.registerApi(this.apiBase, this);
apiManager.updateStoreKey(this.objectConstructor.apiBase);
}
}
}