From 292cfd86862973f355f580844d6fe15c949b2ffb Mon Sep 17 00:00:00 2001 From: Arlindo Pereira Date: Tue, 29 Oct 2024 14:37:04 +0100 Subject: [PATCH] Does not display tooltip if is nullish --- .../overlays/Tooltip/TooltipProvider.stories.tsx | 12 ++++++++++++ src/components/overlays/Tooltip/TooltipProvider.tsx | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/overlays/Tooltip/TooltipProvider.stories.tsx b/src/components/overlays/Tooltip/TooltipProvider.stories.tsx index 4814de6..d1012d0 100644 --- a/src/components/overlays/Tooltip/TooltipProvider.stories.tsx +++ b/src/components/overlays/Tooltip/TooltipProvider.stories.tsx @@ -155,3 +155,15 @@ export const TooltipDraggable: Story = { name: 'Tooltip (draggable anchor)', render: () => , }; + +export const TooltipEmpty: Story = { + args: { + tooltip: '', + }, +}; + +export const TooltipNull: Story = { + args: { + tooltip: null, + }, +}; diff --git a/src/components/overlays/Tooltip/TooltipProvider.tsx b/src/components/overlays/Tooltip/TooltipProvider.tsx index 62da456..c711168 100644 --- a/src/components/overlays/Tooltip/TooltipProvider.tsx +++ b/src/components/overlays/Tooltip/TooltipProvider.tsx @@ -85,7 +85,7 @@ export const TooltipProvider = (props: TooltipProviderProps) => { }, [isMounted, onTooltipActivated, onTooltipDeactivated]); const renderTooltip = () => { - if (!isMounted) { return null; } + if (!isMounted || !tooltip) { return null; } const floatingProps = getFloatingProps({ popover: 'manual',