Skip to content

Commit bcc5d9a

Browse files
committed
sim-rs: fix visualization compilation errors
1 parent b6a673e commit bcc5d9a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

ui/src/components/Graph/modules/Canvas.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const Canvas: FC = () => {
2323
} = useSimContext();
2424
const isDragging = useRef(false);
2525
const dragStart = useRef({ x: 0, y: 0 });
26-
const pointerCapture = useRef<number>();
26+
const pointerCapture = useRef<number | undefined>(undefined);
2727

2828
useEffect(() => {
2929
const canvas = canvasRef.current;

ui/src/contexts/SimContext/SimContextProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const SimContextProvider: FC<PropsWithChildren> = ({ children }) => {
1414
const [state, dispatch] = useReducer(reducer, defaultState);
1515

1616
// load topology
17-
const canvasRef = useRef<HTMLCanvasElement>(defaultState.graph.canvasRef.current);
17+
const canvasRef = useRef<HTMLCanvasElement | null>(defaultState.graph.canvasRef.current);
1818
const resolvedState = useMemo(
1919
() => ({
2020
...state,

ui/src/contexts/SimContext/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export interface ISimulationIntermediateDataState {
104104
}
105105

106106
export interface IGraphContextState {
107-
canvasRef: RefObject<HTMLCanvasElement>;
107+
canvasRef: RefObject<HTMLCanvasElement | null>;
108108
canvasScale: number;
109109
canvasOffsetX: number;
110110
canvasOffsetY: number;

0 commit comments

Comments
 (0)