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

Error with ctrl-keys #33

Open
fdharamshi opened this issue Sep 4, 2024 · 5 comments
Open

Error with ctrl-keys #33

fdharamshi opened this issue Sep 4, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@fdharamshi
Copy link

fdharamshi commented Sep 4, 2024

I'm submitting a...


[x] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

Current behavior

When using reagraph, we use useSelection() -> which uses hotkeys, which in turn uses ctrl-keys
Now, since the change in f540455

I've been getting an error that says keys() is not a function at useHotkeys.ts:20:31

Note: App runs fine. This issue comes up when I run tests.
(I am not even testing reagraph, but my tests fail with the above error.)

Expected behavior

This should not throw this error. It's a blocking issue.

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

I wanted to use reagraph library ASAP, but I am blocked because of this issue.

Environment


Libs:
- react version: 18.0.0
- reakeys version: 2.0.3


Browser:
- [x] Chrome (desktop) version latest
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: 16.18.5
- Platform:  MacOS

Others:

@fdharamshi
Copy link
Author

@amcdnl please take a look^

@amcdnl amcdnl added the bug Something isn't working label Sep 9, 2024
@fdharamshi
Copy link
Author

Hi, any updates on this? @amcdnl @evgenoid

@evgenoid
Copy link

Hi, any updates on this? @amcdnl @evgenoid

@fdharamshi could you provide more details because I can't reproduce it?

@fdharamshi
Copy link
Author

@evgenoid

image

This useSelection you see, internally uses Reakeys which uses CTRL-KEYS
And this is where I was getting the error that says keys() is not a function

@fdharamshi
Copy link
Author

@evgenoid @amcdnl - I had to add jest.mocks in setupTests.js to bypass it for now:

jest.mock('reagraph', () => ({
  install: jest.fn(() => {}),
}));

jest.mock('reakeys', () => ({
  keys: jest.fn(() => {}),
}));

But what would be the right way to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants