We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 96e0c00 + eaadc23 commit 9a88ae8Copy full SHA for 9a88ae8
1 file changed
web/src/components/MetricsPage.tsx
@@ -326,6 +326,17 @@ export const ToggleGraph: React.FC = () => {
326
327
const dispatch = useDispatch();
328
const toggle = React.useCallback(() => dispatch(toggleGraphs()), [dispatch]);
329
+ // Use an empty useEffect to get access to the cleanup function so that if graphs are
330
+ // currently hidden then we toggle one more time as we unmount
331
+ React.useEffect(
332
+ () => () => {
333
+ if (hideGraphs) {
334
+ toggle();
335
+ }
336
+ },
337
+ // eslint-disable-next-line react-hooks/exhaustive-deps
338
+ [hideGraphs],
339
+ );
340
341
const icon = hideGraphs ? <ChartLineIcon /> : <CompressIcon />;
342
0 commit comments