mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix metrics not updating correctly
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
1444c73e47
commit
fb95ca836f
@ -14,6 +14,7 @@ import type { MetricsTab } from "../chart/options";
|
|||||||
import type { MetricData } from "../../../common/k8s-api/endpoints/metrics.api";
|
import type { MetricData } from "../../../common/k8s-api/endpoints/metrics.api";
|
||||||
import type { IAsyncComputed } from "@ogre-tools/injectable-react";
|
import type { IAsyncComputed } from "@ogre-tools/injectable-react";
|
||||||
import { isComputed } from "mobx";
|
import { isComputed } from "mobx";
|
||||||
|
import { observer } from "mobx-react-lite";
|
||||||
|
|
||||||
export type AtLeastOneMetricTab = [MetricsTab, ...MetricsTab[]];
|
export type AtLeastOneMetricTab = [MetricsTab, ...MetricsTab[]];
|
||||||
|
|
||||||
@ -37,7 +38,13 @@ export interface ResourceMetricsValue {
|
|||||||
|
|
||||||
export const ResourceMetricsContext = createContext<ResourceMetricsValue | null>(null);
|
export const ResourceMetricsContext = createContext<ResourceMetricsValue | null>(null);
|
||||||
|
|
||||||
export function ResourceMetrics<Keys extends string>({ object, tabs, children, className, metrics }: ResourceMetricsProps<Keys>) {
|
export const ResourceMetrics = observer(<Keys extends string>({
|
||||||
|
object,
|
||||||
|
tabs,
|
||||||
|
children,
|
||||||
|
className,
|
||||||
|
metrics,
|
||||||
|
}: ResourceMetricsProps<Keys>) => {
|
||||||
const [tab, setTab] = useState<MetricsTab>(tabs[0]);
|
const [tab, setTab] = useState<MetricsTab>(tabs[0]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -76,4 +83,4 @@ export function ResourceMetrics<Keys extends string>({ object, tabs, children, c
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user