-
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] Functional component hook state does not update without refocus #196
Comments
Hi @jordantomax, is this a duplicate of #183 or a slightly different issue? |
@greena13 I believe it's a different issue. I pulled the latest from master, and I can still reproduce in the same way as with the codesandbox. I was looking into trying to contribute, but having a bit of difficulty with the development workflow 🤔 . |
Ok, thanks for confirming and that's great that you're open to contributing. The development workflow at the moment is to try and reproduce any issues with the example application, which you can get started with using something like:
If that's not necessary or you already have a handle on the root cause of the issue, then I generally add a new test that expresses the expectation and fails, and have the test suite automatically run on each save:
There's currently no way to rebuild the example app with each change, if that's how you prefer to work on finding a fix. But there's no reason why a build script couldn't be added to do so. |
@greena13 That makes sense, thanks. Once I do write a test and get it passing, simply doing |
If I'm understanding you correctly, you're using an existing code base (your application) and you're hoping to modify a local fork of If so, you'll need to do something like the following:
Basically, you need to prepublish the local fork to compile the code that is published to npm:
and remove the old version from the
before adding it again from your local version:
Any less, and I have had issues with code changes not taking effect. |
@jordantomax, I'm afraid I have caused confusion again by not reading your response with sufficient care before responding. I try and walk the line between rapid and meaningful responses to issues filed on this repo, but this means I'm often picking them up between other things and I don't always have as much time as I'd like to formulate a considered response. The issue I meant to point you to as a possible duplicate was #182 (and not your own previous issue). Apologies for wasting your time. 😕 |
Fix is now available in v2.0.0-pre8. |
Hi @greena13 apologies for my delayed response, and no worries about the mix up! Just tested with the latest version and everything seems to be working as expected now. Really appreciate your help getting everything fixed 🛠 👍 |
That's fantastic to hear it solved your problems. 😄 A small reminder that if |
@greena13 Questions for you. In the sandbox I created (https://codesandbox.io/embed/ecstatic-https-04p9f), when I add some text, then add 2 line breaks and add some more text, the hotkeys no longer work. It seems specific to the line breaks, any idea what's going on there? Happy to open another issue if it's helpful. |
@jordantomax Line breaks don't really enter A few unlikely ideas are that the linebreak somehow momentarily changes focus. Or that some of the attributes on the A separate issue may indeed be the best place to continue tracking this unusual (but interesting) issue you're seeing. Please include a more detailed description for |
@greena13 Sounds good, I'll create a separate issue with more details. Regarding support, do you have a twitter account I can follow & DM you on? |
Thanks, @jordan. Much appreciated. I have a Twitter account (@aleck_greenham), but don't use the service. I'll be sure to check it over the coming days if you would like to contact me through it, though. |
@greena13 DM'ed. |
Hey @jordantomax, I'm sorry I missed this. I haven't had a response on Twitter. I've checked the above details are correct and I've logged out and back in again. I'm going through my account settings now, but can't see much of relevance. Does it appear to have sent on your end? Update: Scratch that, I found a setting related to receiving DMs. Apologies, but would you mind sending it again? I hope it saved in some form on your side. :/ |
@greena13 hmm, can't seem to DM you. I just wanted to ask the best way to contribute, i.e. what's the best platform. I'm happy to do it while we're using the product (though hooks hotness may give you a run for your 💸😛) You can email me at jordan@kobee.io if you want to keep it private. |
No problem, the support section details the available options. PayPal is preferred for one-off contributions and Patreon for reoccurring. If you'd prefer to use something else, let me know and I'll drop you an email to discuss the specifics. Thanks! |
@greena13 nice! Sent over a small amount. I know it's not a lot, but it's infinitely greater than $0 :) Look forward to the future of the library. |
No problem, it's all appreciated. Thanks! |
Describe the bug
See codesandbox to reproduce: https://codesandbox.io/embed/ecstatic-https-04p9f
Functional component hook state does not update inside of hotKeys bound handler without unfocus and refocus, even when using
allowChanges
.How are you using react hotkeys components? (HotKeys, GlobalHotKeys, IgnoreKeys etc)
HotKeys
Expected behavior
The value coming from the handler function should always be the latest state value
Platform (please complete the following information):
Are you willing and able to create a PR request to fix this issue?
I am. Do you have details about your development workflow? For instance, is there a simple watch script that I can use while developing. most of the instructions I saw were with regards to packaging the production bundle.
APPLICABLE TO v2.0.0-pre1 AND ABOVE: ======================
Include the smallest log that includes your issue:
I think the codesandbox should make the issue pretty clear, but I'm happy to add this if it would help.
What Configuration options are you using?
None
The text was updated successfully, but these errors were encountered: