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

reset namespaceStore metrics on namespace change

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2021-04-13 14:20:55 +03:00
parent 5471db80e4
commit c81dbad5ad
2 changed files with 16 additions and 2 deletions

View File

@ -1,8 +1,8 @@
import "./namespace-details.scss"; import "./namespace-details.scss";
import React from "react"; import React from "react";
import { computed } from "mobx"; import { computed, reaction } from "mobx";
import { observer } from "mobx-react"; import { disposeOnUnmount, observer } from "mobx-react";
import { DrawerItem } from "../drawer"; import { DrawerItem } from "../drawer";
import { cssNames } from "../../utils"; import { cssNames } from "../../utils";
import { Namespace } from "../../api/endpoints"; import { Namespace } from "../../api/endpoints";
@ -37,6 +37,16 @@ export class NamespaceDetails extends React.Component<Props> {
componentDidMount() { componentDidMount() {
resourceQuotaStore.reloadAll(); resourceQuotaStore.reloadAll();
limitRangeStore.reloadAll(); limitRangeStore.reloadAll();
disposeOnUnmount(this, [
reaction(() => this.props.object, () => {
namespaceStore.reset();
})
]);
}
componentWillUnmount() {
namespaceStore.reset();
} }
render() { render() {

View File

@ -181,6 +181,10 @@ export class NamespaceStore extends KubeObjectStore<Namespace> {
await super.remove(item); await super.remove(item);
this.contextNs.delete(item.getName()); this.contextNs.delete(item.getName());
} }
reset() {
this.metrics = null;
}
} }
export const namespaceStore = new NamespaceStore(); export const namespaceStore = new NamespaceStore();