diff --git a/src/ui/React/CodingContractModal.tsx b/src/ui/React/CodingContractModal.tsx index 529dd0c16..dc64d9d66 100644 --- a/src/ui/React/CodingContractModal.tsx +++ b/src/ui/React/CodingContractModal.tsx @@ -24,6 +24,12 @@ export function CodingContractModal(): React.ReactElement { useEffect(() => { CodingContractEvent.subscribe((props) => setContract(props)); }); + useEffect(() => { + return () => { + contract?.onClose(); + }; + }, [contract]); + if (contract === null) return <>; function onChange(event: React.ChangeEvent): void {