diff --git a/cmdk/src/index.tsx b/cmdk/src/index.tsx index d04c215..a79919e 100644 --- a/cmdk/src/index.tsx +++ b/cmdk/src/index.tsx @@ -621,8 +621,10 @@ const Item = React.forwardRef((props, forwardedRef) = const forceMount = propsRef.current?.forceMount ?? groupContext?.forceMount useLayoutEffect(() => { - return context.item(id, groupContext?.id) - }, []) + if (!forceMount) { + return context.item(id, groupContext?.id) + } + }, [forceMount]) const value = useValue(id, ref, [props.value, props.children, ref])