| 1 | "use client"; |
| 2 | |
| 3 | import { useEffect, useRef } from "react"; |
| 4 | |
| 5 | import { type TAntvInfographicElement } from "@/components/notebook/presentation/editor/plugins/antv-infographic-plugin"; |
| 6 | |
| 7 | export function useSyncedAntvElementRef(element: TAntvInfographicElement) { |
| 8 | const elementRef = useRef(element); |
| 9 | |
| 10 | useEffect(() => { |
| 11 | elementRef.current = element; |
| 12 | }, [element]); |
| 13 | |
| 14 | return elementRef; |
| 15 | } |
| 16 |