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

InputGroup & react-hook-form #6777

Open
maxim-kalatsei-idf opened this issue Apr 24, 2024 · 2 comments
Open

InputGroup & react-hook-form #6777

maxim-kalatsei-idf opened this issue Apr 24, 2024 · 2 comments

Comments

@maxim-kalatsei-idf
Copy link

maxim-kalatsei-idf commented Apr 24, 2024

Environment
Package version(s): 5.10.2
Operating System: win 11
Browser name and version: Chrome latest
Code Sandbox
Link to a minimal repro (fork this code sandbox):

Steps to reproduce
1- Doesn t support react hook form now with the {...register("fieldName")}.

Actual behavior

@invliD
Copy link
Member

invliD commented Apr 26, 2024

Could you provide some more details what's actually going wrong here? We do not use react-hook-form and do not support it directly, though if there is a bug in Blueprint that we can fix to resolve this issue, we will accept contributions to do so.

@maxim-kalatsei-idf
Copy link
Author

Hello @invliD,

Thank you for your response. To provide more details, the issue arises when integrating React Hook Form's register function with BlueprintJS components. Specifically, the onChange method from React Hook Form does not seem to work in conjunction with BlueprintJS. This results in the state managed by useForm not being updated as expected when input values change.

Here's an example of the code that's causing the issue:

https://codesandbox.io/p/sandbox/gifted-chatterjee-lwqrnx?file=%2Fsrc%2FApp.js%3A28%2C17

In the above snippet, the expectation is that the onChange event would log the current value of the input field to the console and update the form state accordingly. However, this is not happening when using BlueprintJS's InputGroup component. It seems there might be a conflict or an oversight in how BlueprintJS handles its internal state and events, which prevents React Hook Form from capturing the changes.

I hope this clarifies the issue. If there's a workaround or a potential fix that could be implemented on Blueprint's side to support React Hook Form's functionality, it would greatly enhance the developer experience for those of us integrating these two libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants