import { useEffect , useRef } from 'react' ; import { usePrevious } from '@vendor' ; export const useEffectAllDepsChange = ( fn , deps ) => { const prevDeps = usePrevious ( deps ) ; const changeTarget = useRef < unknown [ ] | undefined > ( ) ; useEffect ( ( ) => { if ( changeTarget . current === undefined ) { changeTarget . current = prevDeps ; } if ( changeTarget . current === undefined ) { return fn ( ) ; } if ( changeTarget . current . every ( ( dep , i ) => dep !== deps [ i ] ) ) { changeTarget . current = deps ; return fn ( ) ; } } , [ fn , prevDeps , deps ] ) ; } ;