Skip to content

Conversation

@joaom00
Copy link
Contributor

@joaom00 joaom00 commented May 29, 2023

When using the following code to add a "Create action", React throws Maximum update depth exceeded error because filtered.count will loop update between 0 and 1

const search = useCommandState((state) => state.search)
const isEmpty = useCommandState((state) => state.filtered.count === 0)

return isEmpty ? <Command.Item forceMount>Create {search}</Command.Item> : null

To fix this the Item is not registered to be filtered when forceMount is true

@vercel
Copy link

vercel bot commented May 29, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cmdk-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2023 1:03am

@pacocoursey pacocoursey merged commit b768f2b into dip:main Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants