Skip to content

Commit

Permalink
Refresh configuration on page load
Browse files Browse the repository at this point in the history
Signed-off-by: Siddhant Deshmukh <[email protected]>
  • Loading branch information
deshsidd committed Nov 12, 2024
1 parent 9b3b60f commit fd67fb9
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions public/pages/Configuration/Configuration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,19 @@ const Configuration = ({
const [windowSize, setWindowSize] = useState(latencySettings.currWindowSize);
const [time, setTime] = useState(latencySettings.currTimeUnit);

const metricSettingsMap = useMemo(
() => ({
const [metricSettingsMap, setMetricSettingsMap] = useState({
latency: latencySettings,
cpu: cpuSettings,
memory: memorySettings,
});

useEffect(() => {
setMetricSettingsMap({
latency: latencySettings,
cpu: cpuSettings,
memory: memorySettings,
}),
[latencySettings, cpuSettings, memorySettings]
);
});
}, [latencySettings, cpuSettings, memorySettings]);

const newOrReset = useCallback(() => {
const currMetric = metricSettingsMap[metric];
Expand All @@ -85,7 +90,7 @@ const Configuration = ({

useEffect(() => {
newOrReset();
}, [newOrReset]);
}, [newOrReset, metricSettingsMap]);

useEffect(() => {
core.chrome.setBreadcrumbs([
Expand Down

0 comments on commit fd67fb9

Please sign in to comment.