-
Notifications
You must be signed in to change notification settings - Fork 160
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
[BUG] Global hotkeys throwing errors after dom changes #150
Comments
Thanks for taking the time to write this issue up and look into its cause, @hadihallak. I'll take a closer look into how this may be occurring and report back. I've created a separate issue to track the fact that the |
@greena13 nevermind. it actually breaks hotkeys but not all of them. thinking it has to do with triggering hotkeys events while a globalhotkeys component is un-mounted. |
Hey, I was able to reproduce the bug here , where you can find all of the code and steps to reproduce: |
Thanks for this, @hadihallak. It will help me tremendously. I am hoping to get some time this weekend to look into this. |
Awesome! let me know if I can help with anything 👍 . |
Same issue here! ☝️ |
Hi @hadihallak @greena13, I have submitted a pull request fixing this issue in #157, would be great to push out an update release with this fix! 🔥 |
Hey @mrlubos. Apologies for the delay in replying. Thanks for the pull request - I see that you closed it, however. What was the reason for this? |
@greena13 I have created a private fork as I intend to make more modifications and needed it to be merged faster, sorry! |
That's quite alright, @mrlubos. My available time to work on this library is unfortunately in fits and spurts - regrettably, there are periods where I cannot be responsive to all issues and PRs as they are submitted. Do you have a more extensive set of fixes for If not, is it still OK to incorporate the code changes you original submitted as a PR? |
Understandable @greena13! Yes, there are more changes I'd like to see and bugs we need to get fixed. Please feel free to incorporate any code you like! |
Hi all... I did a deep dive and wanted to share my findings: The Basics
When Sequence of TroubleThe trouble arises for us in this scenario: two GlobalHotkeys components mounted. One unmounts, the other stays. When the second component unmounts, it calls The user presses a key. We re-mount a GlobalHotkey component again, so there are 2. This process never invokes The user presses a key.
Fixing It@mrlubos original, closed, PR would fix this by invoking Alternatively, Or, someone more familiar with the code than I am may see a more elegant solution. Hoping that sharing exactly why this is happening will help. |
This bug is also affecting my app in production. Would you recommend forking the library temporarily, or do you think there will be a release containing the bug fix shortly? Thank you! |
Hi @jordantomax, thanks for reaching out. This issue will be among the first I will tackle when I can spare some time to work on this library again. However, if you are experiencing issues in production now, I would suggest you temporarily fork and return back in a couple of weeks. |
@greena13 roger that, thanks for the quick reply! |
No problem @jordantomax. @StephenHaney, I really appreciate the work you did in investigating this! This issue is the next one I will tackle. @mrlubos 's initial pull request will be the starting point, but I want to read through Stephen's notes a couple more times to ensure I understand what's going on before attempting to resolve the optimal solution. |
@greena13 The investigation @StephenHaney posted is precisely what led me to the solution I created, sounds good to me! |
Fix is now available in v2.0.0-pre6. |
Awesome @greena13 ! |
Beautiful @greena13! I can confirm that pre6 fixes the issue. Thank you 🙏 |
Describe the bug
When using the GlobalHotKeys component it gives errors after some components mount and unmount.
using any keys seems to give the following error even though the hotkeys are still working and actions are triggering as usual:
How are you using react hotkeys components? (HotKeys, GlobalHotKeys, IgnoreKeys etc)
GlobalHotKeys
Expected behavior
it should not error out.
Platform (please complete the following information):
Are you willing and able to create a PR request to fix this issue?
I did a quick dive and by adding
|| []
at the end of this line, simply solves the issue in our usecase. not sure if this fix is right or if any deeper changes are neededAPPLICABLE TO v2.0.0-pre1 AND ABOVE: ======================
Include the smallest log that includes your issue:
Types seem to be broken so I couldn't import the configure function
The text was updated successfully, but these errors were encountered: