()
| 56 | |
| 57 | // get dimensions of an element |
| 58 | export const useElementDimensions = (): [RefObject<HTMLElement>, Dimensions | undefined] => { |
| 59 | const ref = useRef<HTMLElement>(null); |
| 60 | const [dimensions, setDimensions] = useState<Dimensions | undefined>(); |
| 61 | |
| 62 | useEffect(() => { |
| 63 | if (ref.current) { |
| 64 | const observer = new ResizeObserver((entries) => { |
| 65 | entries.forEach((entry) => { |
| 66 | setDimensions(entry.contentRect); |
| 67 | }); |
| 68 | }); |
| 69 | |
| 70 | const observedRef = ref.current; |
| 71 | |
| 72 | observer.observe(observedRef); |
| 73 | |
| 74 | // Cleanup the observer on component unmount |
| 75 | return () => { |
| 76 | if (observedRef) { |
| 77 | observer.unobserve(observedRef); |
| 78 | } |
| 79 | }; |
| 80 | } |
| 81 | }, []); |
| 82 | |
| 83 | return [ref, dimensions]; |
| 84 | }; |
| 85 | |
| 86 | export const useIsMissingBetaAccess = () => !useActiveFeatureFlags()?.includes("betaAccess"); |
| 87 |
nothing calls this directly
no outgoing calls
no test coverage detected