aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-09-11 17:23:18 +0100
committerGravatar Joe Banks <[email protected]>2024-09-11 17:23:18 +0100
commit2e465735897c828a2f5c81810183a69faaac090d (patch)
treec4741fe83e9ac470e7daf10fe919e68cc4770db8
parentFix eslint (diff)
Spacing
-rw-r--r--thallium-frontend/src/utils/hooks.ts2
1 files changed, 2 insertions, 0 deletions
diff --git a/thallium-frontend/src/utils/hooks.ts b/thallium-frontend/src/utils/hooks.ts
index 337ccf2..a98cfb3 100644
--- a/thallium-frontend/src/utils/hooks.ts
+++ b/thallium-frontend/src/utils/hooks.ts
@@ -8,8 +8,10 @@ export function useVisible(ref: RefObject<HTMLElement>) {
const observer = new IntersectionObserver(
([entry]) => { setVisible(entry.isIntersecting); }
);
+
if (ref.current)
observer.observe(ref.current);
+
return () => { observer.disconnect(); };
}, [ref]);