From 79f2424a8a61439b81feab817f83a29d27752006 Mon Sep 17 00:00:00 2001 From: Cole Lawrence Date: Mon, 16 May 2022 14:05:01 -0400 Subject: [PATCH] refactor for useTooltip remove unnecessary as $IntentionalAny --- theatre/studio/src/panels/OutlinePanel/OutlinePanel.tsx | 5 ++--- theatre/studio/src/uiComponents/Popover/useTooltip.tsx | 8 +++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/theatre/studio/src/panels/OutlinePanel/OutlinePanel.tsx b/theatre/studio/src/panels/OutlinePanel/OutlinePanel.tsx index 5f4afac..b6c456d 100644 --- a/theatre/studio/src/panels/OutlinePanel/OutlinePanel.tsx +++ b/theatre/studio/src/panels/OutlinePanel/OutlinePanel.tsx @@ -9,7 +9,6 @@ import {usePrism} from '@theatre/react' import getStudio from '@theatre/studio/getStudio' import {val} from '@theatre/dataverse' import useTooltip from '@theatre/studio/uiComponents/Popover/useTooltip' -import type {$IntentionalAny} from '@theatre/shared/utils/types' import BasicTooltip from '@theatre/studio/uiComponents/Popover/BasicTooltip' import ErrorTooltip from '@theatre/studio/uiComponents/Popover/ErrorTooltip' @@ -148,7 +147,7 @@ const OutlinePanel: React.FC<{}> = (props) => { ) }, []) - const [triggerTooltip, triggerButtonRef] = useTooltip( + const [triggerTooltip, triggerButtonRef] = useTooltip( {enabled: conflicts.length > 0, enterDelay: conflicts.length > 0 ? 0 : 200}, () => conflicts.length > 0 ? ( @@ -167,7 +166,7 @@ const OutlinePanel: React.FC<{}> = (props) => { {triggerTooltip} diff --git a/theatre/studio/src/uiComponents/Popover/useTooltip.tsx b/theatre/studio/src/uiComponents/Popover/useTooltip.tsx index 69813d5..861da80 100644 --- a/theatre/studio/src/uiComponents/Popover/useTooltip.tsx +++ b/theatre/studio/src/uiComponents/Popover/useTooltip.tsx @@ -9,7 +9,7 @@ import {useTooltipOpenState} from './TooltipContext' import {PortalContext} from 'reakit' import noop from '@theatre/shared/utils/noop' -export default function useTooltip( +export default function useTooltip( opts: { enabled?: boolean enterDelay?: number @@ -20,15 +20,13 @@ export default function useTooltip( render: () => React.ReactElement, ): [ node: React.ReactNode, - targetRef: MutableRefObject, + targetRef: MutableRefObject, isOpen: boolean, ] { const enabled = opts.enabled !== false const [isOpen, setIsOpen] = useTooltipOpenState() - const [targetRef, targetNode] = useRefAndState< - HTMLElement | SVGElement | null - >(null) + const [targetRef, targetNode] = useRefAndState(null) useEffect(() => { if (!enabled) {