-
Notifications
You must be signed in to change notification settings - Fork 858
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: duplicate modal instances from hotkey activation #1058
fix: duplicate modal instances from hotkey activation #1058
Conversation
…Bug-fix-command-menu-renders
@deepgolani4 is attempting to deploy a commit to the Documenso Team Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe update involves enhancing the Changes
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (2)
Files skipped from review as they are similar to previous changes (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Hey There! and thank you for opening this pull request! 📝👋🏼 We require pull request titles to follow the Conventional Commits Spec and it looks like your proposed title needs to be adjusted. Details:
|
Hey there, it looks like you haven't accepted our contributor license agreement yet. In order for us to accept your pull request we ask that you please fill out the CLA: |
@Mythie , apologies for the direct ping, but I would appreciate your input on handling an edge case or suggesting a more suitable approach for this codebase. |
isCommandMenuOpen?: boolean; | ||
setIsCommandMenuOpen?: (value: boolean) => void; |
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.
I think it's fine to just force these to not be undefined since this component isn't reused (and isn't planned to be reused) anywhere else
This would let us clean up the code a little and remove the open state here and get rid of the CommandMenu
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.
Thanks 🙏
@deepgolani4 thank you this bothered my a lot, especially in demos :D |
Description
Currently, when the command menu is opened using the Command+K hotkey, two modals are getting rendered.
This is because the modals are mounted in two components: header and desktop-nav. Upon triggering the hotkey, both modals are rendered.
Related Issue
#1032
Changes Made
The changes I made are in the desktop nav component. If the desktop nav receives the command menu state value and the state setter function, it will trigger only that. If not, it will trigger the state setter that is defined in the desktop nav. This way, we are preventing the modal from mounting two times.
Testing Performed
Checklist
Summary by CodeRabbit
DesktopNav
component, allowing for smoother interactions and control.CommandMenu
component and managing its functionality withinDesktopNav
.