Skip to content

Commit

Permalink
Merge pull request #154 from godspeedelbow/godspeedelbow-patch-1
Browse files Browse the repository at this point in the history
make sure only memoisedCallback is unbound (closes #153)
  • Loading branch information
JohannesKlauss authored Sep 9, 2019
2 parents 11e6cce + f2c28a8 commit 3bccf62
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export function useHotkeys(keys: string, callback: CallbackFn, deps: any[] = [])
useEffect(() => {
hotkeys(keys, memoisedCallback);

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

1 comment on commit 3bccf62

@godspeedelbow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JohannesKlauss I'd suggest bumping the major version for this change as it's breaking for people that rely on the old behavior

Please sign in to comment.