Skip to content

Commit eef3cb5

Browse files
authored
fix: Keep k8s dashboard params up to date with defaulted sources (#1258)
1 parent ec2ea56 commit eef3cb5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packages/app/src/KubernetesDashboardPage.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { useMemo } from 'react';
2+
import { useEffect, useMemo } from 'react';
33
import dynamic from 'next/dynamic';
44
import Link from 'next/link';
55
import cx from 'classnames';
@@ -833,6 +833,18 @@ function KubernetesDashboardPage() {
833833
},
834834
});
835835

836+
useEffect(() => {
837+
if (logSourceId && logSourceId !== _logSourceId) {
838+
setLogSourceId(logSourceId);
839+
}
840+
}, [logSourceId, _logSourceId, setLogSourceId]);
841+
842+
useEffect(() => {
843+
if (metricSourceId && metricSourceId !== _metricSourceId) {
844+
setMetricSourceId(metricSourceId);
845+
}
846+
}, [metricSourceId, _metricSourceId, setMetricSourceId]);
847+
836848
watch((data, { name, type }) => {
837849
if (name === 'logSourceId' && type === 'change') {
838850
setLogSourceId(data.logSourceId ?? null);

0 commit comments

Comments
 (0)