Skip to content

Commit

Permalink
Reset metric search param if metric not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
nasaownsky committed Jun 12, 2024
1 parent 09a5875 commit 0ace177
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion publisher/src/components/DataViz/MetricsDataChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ export const MetricsDataChart: React.FC = observer(() => {

useEffect(() => {
if (currentMetric && currentSystem) {
const isMetricEnabled = enabledMetrics.some(
(metric) => metric.key === currentMetric.key
);
window.history.replaceState(
"",
"",
Expand All @@ -196,7 +199,7 @@ export const MetricsDataChart: React.FC = observer(() => {
dataVizStore.setInitialStateFromSearchParams();
setSettingsSearchParams({
system: currentSystem,
metric: currentMetric.key,
metric: isMetricEnabled ? currentMetric.key : undefined,
});
}
/**
Expand Down

0 comments on commit 0ace177

Please sign in to comment.