meh
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { useEffect } from 'react'
|
||||
import { useLocation } from 'react-router-dom'
|
||||
import { useEffect, useRef } from 'react'
|
||||
|
||||
export default function useLayoutInit() {
|
||||
const { pathname } = useLocation()
|
||||
const initialized = useRef(false)
|
||||
|
||||
useEffect(() => {
|
||||
if (initialized.current) return
|
||||
initialized.current = true
|
||||
let destroyed = false
|
||||
let rafId = null
|
||||
|
||||
@@ -45,5 +46,5 @@ export default function useLayoutInit() {
|
||||
if (rafId) cancelAnimationFrame(rafId)
|
||||
clearTimeout(fallback)
|
||||
}
|
||||
}, [pathname])
|
||||
}, [])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user