diff --git a/src/components/Form/Modal.tsx b/src/components/Form/Modal.tsx index 610436a5..16a0b994 100644 --- a/src/components/Form/Modal.tsx +++ b/src/components/Form/Modal.tsx @@ -57,13 +57,13 @@ const Modal: React.FC = ({ children, isOpen, closeModal }) => { } }; - const handleEscPress = (e: KeyboardEvent) => { - if (e.key === 'Escape') { - closeModal(); - } - }; - React.useEffect(() => { + const handleEscPress = (e: KeyboardEvent) => { + if (e.key === 'Escape') { + closeModal(); + } + }; + if (isOpen) { window.addEventListener('keydown', handleEscPress); } @@ -71,7 +71,7 @@ const Modal: React.FC = ({ children, isOpen, closeModal }) => { return () => { window.removeEventListener('keydown', handleEscPress); }; - }, [isOpen]); + }, [isOpen, closeModal]); if (!isOpen) { return null; diff --git a/src/components/misc/FancyBackground.tsx b/src/components/misc/FancyBackground.tsx index 626a5782..cc963a89 100644 --- a/src/components/misc/FancyBackground.tsx +++ b/src/components/misc/FancyBackground.tsx @@ -1,4 +1,4 @@ -import { useEffect } from "react"; +import { useEffect, useMemo } from "react"; const FancyBackground = (): JSX.Element => { @@ -25,7 +25,7 @@ const FancyBackground = (): JSX.Element => { return result; }; - const App: any = {}; + const App: any = useMemo(() => [], []); App.setup = function () { @@ -335,7 +335,7 @@ const FancyBackground = (): JSX.Element => { requestAnimationFrame(frame); }; frame(); - }, []); + }, [App]); diff --git a/src/pages/About.tsx b/src/pages/About.tsx index 922e00a3..da002d42 100644 --- a/src/pages/About.tsx +++ b/src/pages/About.tsx @@ -172,6 +172,7 @@ const About = (): JSX.Element => { API Documentation
+ {/* eslint-disable-next-line*/}

// Coming soon...

diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index bf2afba8..be19c3c0 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -38,6 +38,7 @@ const UserInputMain = styled.form` z-index: 2; `; +/* const FindIpButton = styled.a` margin: 0.5rem; cursor: pointer; @@ -46,6 +47,7 @@ const FindIpButton = styled.a` color: ${colors.primary}; text-decoration: underline; `; +*/ const ErrorMessage = styled.p` color: ${colors.danger}; @@ -126,6 +128,8 @@ const Home = (): JSX.Element => { if (!isError) setErrMsg(''); }; + + // eslint-disable-next-line const findIpAddress = () => { setUserInput(''); setPlaceholder('Looking up your IP...'); @@ -143,6 +147,7 @@ const Home = (): JSX.Element => { }); }; + const formSubmitEvent = (event: FormEvent) => { event.preventDefault(); submit(); diff --git a/src/pages/Results.tsx b/src/pages/Results.tsx index 5042b910..80d9ab9d 100644 --- a/src/pages/Results.tsx +++ b/src/pages/Results.tsx @@ -132,7 +132,7 @@ const Results = (): JSX.Element => { } return newJobs; }); - }, []); + }, [startTime]); const parseJson = (response: Response): Promise => { return new Promise((resolve) => { @@ -147,15 +147,6 @@ const Results = (): JSX.Element => { }); }; - useEffect(() => { - if (!addressType || addressType === 'empt') { - setAddressType(determineAddressType(address || '')); - } - if (addressType === 'ipV4' && address) { - setIpAddress(address); - } - }, []); - const urlTypeOnly = ['url'] as AddressType[]; // Many jobs only run with these address types const api = '/api'; @@ -170,6 +161,15 @@ const Results = (): JSX.Element => { .then(res => res.ip), }); + useEffect(() => { + if (!addressType || addressType === 'empt') { + setAddressType(determineAddressType(address || '')); + } + if (addressType === 'ipV4' && address) { + setIpAddress(address); + } + }, [address, addressType, setIpAddress]); + // Fetch and parse SSL certificate info const [sslResults, updateSslResults] = useMotherHook({ jobId: 'ssl',