-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Editor: not render data with React Hook Form #6950
Editor: not render data with React Hook Form #6950
Comments
Please fork the Stackblitz project and create a case demonstrating your bug report. This issue will be closed if no activities in 20 days. |
HI @melloware , this is the code: |
@swotiendang it works outside of React Hook Form see my reproducer: https://stackblitz.com/edit/vitejs-vite-mdqney?file=package.json,src%2FApp.jsx You might want to debug RHF. |
Hi @melloware , please take a look at this image: the value is passed to Editor but it didn't display, in this case, I highly believe it's issue of Editor, not ReactFormHook |
But if you look at my example why does it work outside of RHF? |
@melloware I cannot tell, what I can see value props is passed to Editor successfully, but it renders nothing. My guess is: Editor in primereact handle shouldComponentUpdate incorrectly, I would browse into source code of Editor when having time to check. Some other people faces the same issue: https://stackoverflow.com/questions/78421490/im-not-able-to-render-data-in-the-prime-react-editor |
@avasuro any thoughts you just recently made changes to editor... |
No ideas for now, but I have more minimalistic reproduction, which shows that same bug reproduces also outside RHF: Here bug reproduces if input value changes in some useEffect immediately after first render. To make demo work as expected - comment setValue inside useEffect and uncomment setTimeout function to update input value with a little delay. P.S.: I think it's because of closure to initQuill function, that contains reference to initial (empty) props.value instead of taking the most up to date, and useUpdateEffect doesn't called on first rerender, because quill is not initialized at that moment (quill.current is undefined). P.P.S.: I think I have a fix for that (just, probably, a bit ugly) |
nice work @avasuro |
Thanks @melloware , @avasuro |
This issue is still present in 10.8.2
|
@OldManMeta make sure to remove node_modules and do npm install. It should my problem after upgrade to [email protected] |
Yeah tried several ways to try to get this to work - just couldn't. In the end reverted back to react-quill directly. Thanks for the response - love primereact BTW. |
Describe the bug
Cannot render data in Editor
Reproducer
https://stackblitz.com/edit/vitejs-vite-ccxqty?file=src%2FApp.jsx
System Information
Steps to reproduce the behavior
No response
Expected behavior
No response
The text was updated successfully, but these errors were encountered: