diff --git a/ivette/src/frama-c/kernel/ASTinfo.tsx b/ivette/src/frama-c/kernel/ASTinfo.tsx index e538e0426276f0779811b323ba19780c948d671f..4db1300e6262d71d0729d7b0ca0c99c5ab9ceea7 100644 --- a/ivette/src/frama-c/kernel/ASTinfo.tsx +++ b/ivette/src/frama-c/kernel/ASTinfo.tsx @@ -310,14 +310,14 @@ export default function ASTinfo(): JSX.Element { React.useEffect(() => { markers.setLocations(selectedLoc, hoveredLoc); }, [markers, selectedLoc, hoveredLoc]); - const pinMarker = (location: States.Location) : void => { + const pinMarker = React.useCallback((location: States.Location) => { if (location?.marker) markers.setPinned(location?.marker, true); - }; + }, [markers]); React.useEffect(() => { States.MetaSelection.on(pinMarker); return () => States.MetaSelection.off(pinMarker); - }); + }, [pinMarker]); // Rendering const renderMark = (mark: Mark): JSX.Element | null => { const { marker } = mark;