diff --git a/packages/core/client/src/schema-component/hooks/useTableSize.ts b/packages/core/client/src/schema-component/hooks/useTableSize.ts index 6a5a41a1e..4b9b02153 100644 --- a/packages/core/client/src/schema-component/hooks/useTableSize.ts +++ b/packages/core/client/src/schema-component/hooks/useTableSize.ts @@ -3,7 +3,7 @@ import { useCallback, useRef, useState } from 'react'; export const useTableSize = () => { const [height, setTableHeight] = useState(0); const [width, setTableWidth] = useState(0); - const elementRef = useRef(); + const elementRef = useRef(null); const calcTableSize = useCallback(() => { if (!elementRef.current) return; @@ -21,7 +21,7 @@ export const useTableSize = () => { }, []); const tableSizeRefCallback: React.RefCallback = (ref) => { - elementRef.current = ref; + elementRef.current = ref && ref.children ? (ref.children[0] as HTMLDivElement) : null; calcTableSize(); };