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:
parent
5471db80e4
commit
c81dbad5ad
@ -1,8 +1,8 @@
|
||||
import "./namespace-details.scss";
|
||||
|
||||
import React from "react";
|
||||
import { computed } from "mobx";
|
||||
import { observer } from "mobx-react";
|
||||
import { computed, reaction } from "mobx";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import { DrawerItem } from "../drawer";
|
||||
import { cssNames } from "../../utils";
|
||||
import { Namespace } from "../../api/endpoints";
|
||||
@ -37,6 +37,16 @@ export class NamespaceDetails extends React.Component<Props> {
|
||||
componentDidMount() {
|
||||
resourceQuotaStore.reloadAll();
|
||||
limitRangeStore.reloadAll();
|
||||
|
||||
disposeOnUnmount(this, [
|
||||
reaction(() => this.props.object, () => {
|
||||
namespaceStore.reset();
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
namespaceStore.reset();
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@ -181,6 +181,10 @@ export class NamespaceStore extends KubeObjectStore<Namespace> {
|
||||
await super.remove(item);
|
||||
this.contextNs.delete(item.getName());
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.metrics = null;
|
||||
}
|
||||
}
|
||||
|
||||
export const namespaceStore = new NamespaceStore();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user