Skip to content

Commit be4388e

Browse files
committed
remove firstRender logic from Command.Empty, fixes #149
1 parent 54aa261 commit be4388e

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

cmdk/src/index.tsx

+1-6
Original file line numberDiff line numberDiff line change
@@ -877,14 +877,9 @@ const Dialog = React.forwardRef<HTMLDivElement, DialogProps>((props, forwardedRe
877877
* Automatically renders when there are no results for the search query.
878878
*/
879879
const Empty = React.forwardRef<HTMLDivElement, EmptyProps>((props, forwardedRef) => {
880-
const isFirstRender = React.useRef(true)
881880
const render = useCmdk((state) => state.filtered.count === 0)
882881

883-
React.useEffect(() => {
884-
isFirstRender.current = false
885-
}, [])
886-
887-
if (isFirstRender.current || !render) return null
882+
if (!render) return null
888883
return <Primitive.div ref={forwardedRef} {...props} cmdk-empty="" role="presentation" />
889884
})
890885

0 commit comments

Comments
 (0)