-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix command menu keyboard navigation #2908
Conversation
Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com>
@@ -3,13 +3,14 @@ import { IconComponent } from '@/ui/display/icon/types/IconComponent'; | |||
export enum CommandType { | |||
Navigate = 'Navigate', | |||
Create = 'Create', | |||
Other = 'Other', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other is too vague and at risk of being a catch-all type for everything, we can put 'OpenDrawer' or something like that.
@@ -118,6 +120,17 @@ export const CommandMenu = () => { | |||
], | |||
}, | |||
limit: 3, | |||
onCompleted: (data) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should put all the onCompleted in useEffects, because onCompleted isn't retriggered when we're updating the cache with optimistic effects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @lucasbordeau Adding a useEffect
just caused too many rerenders, please check out the change I went with.
Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com>
Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you!
Refer to: #2778 (comment)
Fixes #2746