Skip to content
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

Duplicate hotkey usages interfere with each other #153

Closed
godspeedelbow opened this issue Sep 6, 2019 · 2 comments
Closed

Duplicate hotkey usages interfere with each other #153

godspeedelbow opened this issue Sep 6, 2019 · 2 comments

Comments

@godspeedelbow
Copy link
Contributor

godspeedelbow commented Sep 6, 2019

I have two components, mounted simultaneously, that both register the same hotkey:

useHotkeys(
  "ctrl+f",
  useCallback(onOpen, [])
);

Whenever one of them gets unmounted, the hotkey stops working for the other component as well.

I think it's because of this line:

return () => hotkeys.unbind(keys);

Because when I change it to:

return () => hotkeys.unbind(keys, memoisedCallback);

it works as expected.

@JohannesKlauss
Copy link
Owner

Thank you very much for the bug report. Would you mind to create a PR with the change?

@godspeedelbow
Copy link
Contributor Author

#154

👍

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

No branches or pull requests

2 participants