From c9a59adf356e8c656c47b1baca2bc3068a164c7f Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Mon, 15 Aug 2022 15:22:04 -0400 Subject: [PATCH] Fix snapshots Signed-off-by: Sebastian Malton --- .../edit-namespace-from-new-tab.test.tsx.snap | 12 ++++++------ src/renderer/components/badge/badge.tsx | 10 ++++------ 2 files changed, 10 insertions(+), 12 deletions(-) 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(() => {