diff --git a/src/data/Ellipsis/Ellipsis.tsx b/src/data/Ellipsis/Ellipsis.tsx index 802beb25..18c937cf 100644 --- a/src/data/Ellipsis/Ellipsis.tsx +++ b/src/data/Ellipsis/Ellipsis.tsx @@ -89,10 +89,6 @@ export const Ellipsis: FC = ({ }, [expandable, limit, value, removeLinebreaks]); const measureText = useCallback(() => { - if (!contentRef.current) { - return; - } - if (lines === undefined) { if (substr.length !== value.length) { setTruncatedText(substr); @@ -102,6 +98,10 @@ export const Ellipsis: FC = ({ return; } + if (!contentRef.current) { + return; + } + const content = contentRef.current; const lineHeight = parseInt(window.getComputedStyle(content).lineHeight); const maxHeight = lines ? lineHeight * lines : content.clientHeight;