This commit is contained in:
2026-07-18 15:48:29 +00:00
parent b60987323e
commit 5b31247e50
10 changed files with 844 additions and 32 deletions

View File

@@ -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])
}, [])
}