diff --git a/src/behaviours/cluster/namespaces/__snapshots__/edit-namespace-from-new-tab.test.tsx.snap b/src/behaviours/cluster/namespaces/__snapshots__/edit-namespace-from-new-tab.test.tsx.snap index 78e074c57b..3d062ac38e 100644 --- a/src/behaviours/cluster/namespaces/__snapshots__/edit-namespace-from-new-tab.test.tsx.snap +++ b/src/behaviours/cluster/namespaces/__snapshots__/edit-namespace-from-new-tab.test.tsx.snap @@ -4208,7 +4208,7 @@ exports[`cluster/namespaces - edit namespace from new tab when navigating to nam Kind:
Namespace
@@ -4216,7 +4216,7 @@ exports[`cluster/namespaces - edit namespace from new tab when navigating to nam Name:
some-name
@@ -4224,7 +4224,7 @@ exports[`cluster/namespaces - edit namespace from new tab when navigating to nam Namespace:
default
@@ -7856,7 +7856,7 @@ exports[`cluster/namespaces - edit namespace from new tab when navigating to nam Kind:
Namespace
@@ -7864,7 +7864,7 @@ exports[`cluster/namespaces - edit namespace from new tab when navigating to nam Name:
some-name
@@ -7872,7 +7872,7 @@ exports[`cluster/namespaces - edit namespace from new tab when navigating to nam Namespace:
default
diff --git a/src/renderer/components/badge/badge.tsx b/src/renderer/components/badge/badge.tsx index 4f4215d509..b23d7623e5 100644 --- a/src/renderer/components/badge/badge.tsx +++ b/src/renderer/components/badge/badge.tsx @@ -43,7 +43,7 @@ export const Badge = withTooltip(observer(({ const elem = useRef(null); const elemHasBeenSet = useRef(false); const [isExpanded, setIsExpanded] = useState(false); - const [isExpandable, setIsExpandable] = useState(expandable); + const [isExpandable, setIsExpandable] = useState(false); useEffect(() => { if (elemHasBeenSet.current) { @@ -54,11 +54,9 @@ export const Badge = withTooltip(observer(({ elemHasBeenSet.current = true; } - setIsExpandable(( - expandable && elem.current - ? elem.current.clientWidth < elem.current.scrollWidth - : false - )); + const { clientWidth = 0, scrollWidth = 0 } = elem.current ?? {}; + + setIsExpandable(expandable && (clientWidth < scrollWidth)); }, [expandable, elem.current]); const onMouseUp = action(() => {