mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
reset store on loading error
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
76ee3656a2
commit
da3aa618d7
@ -114,11 +114,16 @@ export abstract class KubeObjectStore<T extends KubeObject = any> extends ItemSt
|
|||||||
this.isLoaded = true;
|
this.isLoaded = true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Loading store items failed", { error, store: this });
|
console.error("Loading store items failed", { error, store: this });
|
||||||
|
this.resetOnError(error);
|
||||||
} finally {
|
} finally {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected resetOnError(error: any) {
|
||||||
|
if (error) this.reset();
|
||||||
|
}
|
||||||
|
|
||||||
protected async loadItem(params: { name: string; namespace?: string }): Promise<T> {
|
protected async loadItem(params: { name: string; namespace?: string }): Promise<T> {
|
||||||
return this.api.get(params);
|
return this.api.get(params);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user