fix(www): command menu shortcut reactivity after clearing search input #8428
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey there!
I've found a small issue that occurs when having a searching for something on the docs' cmd+k command menu and then clearing it.
The issue
What currently happens is that the
CommandMenuItem
component isn't re-rendered and made aware of changes in the search after clearing a given search input, and the mutation observer won't trigger any events. This leads to the bottom section of theCommandMenu
(the shortcut hints) being out of sync with the highlighted command menu item.It's best visible in a screen recording (watch how the bottom shortcut hints don't match the highlighted item after clearing the input):
Screen.Recording.2025-10-11.at.22.54.03.mov
My fix
I just added a call to
useCommandState
insideCommandMenuItem
which makes it properly reactive. I hope this is the best solution for this.After:
Screen.Recording.2025-10-11.at.22.55.52.mov