Skip to content

Commit

Permalink
fix(frontend): TypeScript errors in Simulations (#579)
Browse files Browse the repository at this point in the history
Fix a couple of small TS errors in the `Simulations` component.
  • Loading branch information
eatyourgreens authored Nov 22, 2024
1 parent 3e4207c commit 176429c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions frontend-v2/src/features/simulation/Simulations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { useFieldArray, useForm } from "react-hook-form";
import {
ChangeEvent,
FC,
MutableRefObject,
useCallback,
useEffect,
useMemo,
Expand Down Expand Up @@ -398,12 +399,12 @@ const Simulations: FC = () => {
width: window.innerWidth,
});

const containerRef = useRef(null);
const containerRef: MutableRefObject<HTMLElement | null> = useRef(null);

useEffect(() => {
const debouncedHandleResize = debounce(function handleResize() {
setDimensions({
width: containerRef?.current?.clientWidth,
width: containerRef?.current?.clientWidth || 0,
});
}, 1000);

Expand All @@ -417,7 +418,7 @@ const Simulations: FC = () => {
window.removeEventListener("eventExpand", debouncedHandleResize);
};
});

const loading = [
isProjectLoading,
isSimulationsLoading,
Expand Down Expand Up @@ -476,7 +477,13 @@ const Simulations: FC = () => {
wrap={layout === "horizontal" ? "nowrap" : "wrap"}
>
{plots.map((plot, index) => (
<Grid xl={screen.width > 2500 ? 4 : 6} md={12} sm={12} item key={index}>
<Grid
xl={screen.width > 2500 ? 4 : 6}
md={12}
sm={12}
item
key={index}
>
{data?.length && model ? (
<SimulationPlotView
index={index}
Expand Down

0 comments on commit 176429c

Please sign in to comment.