diff --git a/frontend/src/components/@common/Toast/index.tsx b/frontend/src/components/@common/Toast/index.tsx index 515584c6d..9c24cf500 100644 --- a/frontend/src/components/@common/Toast/index.tsx +++ b/frontend/src/components/@common/Toast/index.tsx @@ -39,7 +39,7 @@ const Toast = (props: ToastItem) => { setTimeout(() => { setToastList((prev) => prev.filter(({ id: toastId }) => toastId !== id)); }, 200); - }, []); + }, [id, setToastList]); const handleClickButton = () => { onClickButton?.(); diff --git a/frontend/src/hooks/@common/useIntersectionRef.ts b/frontend/src/hooks/@common/useIntersectionRef.ts index ef188250b..2ac264231 100644 --- a/frontend/src/hooks/@common/useIntersectionRef.ts +++ b/frontend/src/hooks/@common/useIntersectionRef.ts @@ -2,11 +2,14 @@ import { useCallback, useMemo } from 'react'; import createObserver from 'utils/createObserver'; const useIntersectionRef = (onIntersecting: () => void) => { - const observer = useMemo(() => createObserver(onIntersecting), []); + const observer = useMemo(() => createObserver(onIntersecting), [onIntersecting]); - const intersectionRef = useCallback((instance: T | null) => { - if (instance) observer.observe(instance); - }, []); + const intersectionRef = useCallback( + (instance: T | null) => { + if (instance) observer.observe(instance); + }, + [observer] + ); return intersectionRef; };