Skip to content

Commit a3fa86b

Browse files
committed
only check if _mainTreeNodeRef is passed in
It can be that it is passed in but still `null`, that's fine because it means it will be passed in later once the DOM is ready.
1 parent 8a37854 commit a3fa86b

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

packages/@headlessui-react/src/hooks/use-root-containers.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { useRef, useMemo, MutableRefObject } from 'react'
22
import { Hidden, Features as HiddenFeatures } from '../internal/hidden'
3-
import { useComputed } from './use-computed'
43
import { useEvent } from './use-event'
54
import { useOwnerDocument } from './use-owner'
65

@@ -60,15 +59,10 @@ export function useRootContainers({
6059
mainTreeNodeRef,
6160
MainTreeNode: useMemo(() => {
6261
return function MainTreeNode() {
63-
let hasPassedInMainTreeNode = useComputed(
64-
() => (_mainTreeNodeRef?.current ?? null) !== null,
65-
[_mainTreeNodeRef]
66-
)
67-
if (hasPassedInMainTreeNode) return null
68-
62+
if (_mainTreeNodeRef != null) return null
6963
return <Hidden features={HiddenFeatures.Hidden} ref={mainTreeNodeRef} />
7064
}
71-
}, [mainTreeNodeRef]),
65+
}, [mainTreeNodeRef, _mainTreeNodeRef]),
7266
}
7367
}
7468

0 commit comments

Comments
 (0)