File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {
10
10
} from "../ui/tooltip"
11
11
12
12
import { useDisclosure } from "@/hooks/useDisclosure"
13
+ import { useIsClient } from "@/hooks/useIsClient"
13
14
14
15
export type TooltipProps = ComponentProps < typeof Popover > & {
15
16
content : ReactNode
@@ -24,6 +25,7 @@ const Tooltip = ({
24
25
...props
25
26
} : TooltipProps ) => {
26
27
const { isOpen, onOpen, onClose } = useDisclosure ( )
28
+ const isClient = useIsClient ( )
27
29
28
30
// Close the popover when the user scrolls.
29
31
// This is useful for mobile devices where the popover is open by clicking the
@@ -64,6 +66,12 @@ const Tooltip = ({
64
66
}
65
67
}
66
68
69
+ // Avoid rendering on the server since the user can't interact with it and we
70
+ // need to use different components depending on the device
71
+ if ( ! isClient ) {
72
+ return null
73
+ }
74
+
67
75
// Use Popover on mobile devices since the user can't hover
68
76
const Component = isMobile ( ) ? Popover : Tooltipcomponent
69
77
const Trigger = isMobile ( ) ? PopoverTrigger : TooltipTrigger
You can’t perform that action at this time.
0 commit comments