-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Hotkeys component results in TypeError with ES6 target #2972
Comments
I tried a similar workaround as you but it worked for me, the only change I made was inside the function where I am not doing anything
|
@sumit-sinha are you by any chance wrapping a component that doesn't use state (i.e. never accesses When I try using your approach, I run into null property accesses in my wrapped component's |
@sushain97 yes I tried with a stateless component |
@sumit-sinha ah. Here's how I modified your solution a bit to work for stateful apps and support an arbitrary number of hotkeys with callbacks that use the state while maintaining some type safety: sushain97/web2fs-notepad@63e0dbf. |
@sushain97 yeah wrapping a stateful component in a stateless component seems to work well quick recap
|
@sushain97 see #1725: Hotkeys only work if value returned from this is a known issue and a significant limitation of our decorator APIs. 🤷♂️ |
Is this going to be addressed soon? |
@biels no, as a proper fix likely requires an API break (and a major version) which we are not prepared to develop at the moment. |
The simpler solution for me was to just use |
because of palantir/blueprint#2972 the testability of the app was broken
Fixed by migrating to HotkeysTarget2 or useHotkeys |
N.B. this is a more actionable version of #2535 with repro links.
Environment
Steps to reproduce
target: es6
intsconfig.json
.@HotkeysTarget
and associated code as the docs describe.Rationale
Per @giladgray
In general, this makes sense to me. However, I would consider apps primarily intended for personal/internal use where modern browsers are implied as an exception (or Electron apps). Forwards compatibility also seems like a good way to 'future proof'.
Actual behavior
See https://codesandbox.io/s/7yp63vw621:
I think this breakage will also affect other decorators.
Expected behavior
Hotkeys work as expected.
See https://codesandbox.io/s/q3jk1n66mj.
Possible solution
I tried using the following to get around this but didn't have much luck:
The
render
call fromHotkeysTarget
still never gets called.The text was updated successfully, but these errors were encountered: