docs: improve references loading (#13761)

* docs: improve references loading

* remove comment

* try remove generate metadata

* improvements and fixes
This commit is contained in:
Shahed Nasser
2025-10-16 14:25:01 +03:00
committed by GitHub
parent 4eb9628514
commit e36c054780
11 changed files with 379 additions and 107 deletions
@@ -0,0 +1,33 @@
"use client"
import { useEffect } from "react"
type UseMutationObserverProps = {
elm: Document | HTMLElement | undefined
callback: () => void
options?: {
attributes?: boolean
characterData?: boolean
childList?: boolean
subtree?: boolean
}
}
export const useMutationObserver = ({
elm,
callback,
options = {
attributes: true,
characterData: true,
childList: true,
subtree: true,
},
}: UseMutationObserverProps) => {
useEffect(() => {
if (elm) {
const observer = new MutationObserver(callback)
observer.observe(elm, options)
return () => observer.disconnect()
}
}, [callback, options])
}