-
Notifications
You must be signed in to change notification settings - Fork 31
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 report: mismatch between displayed value and internal state #166
Comments
Thank you! Here is a demonstration: Initially, the data and displayed values were consistent. I edited However, a discrepancy occurred when I started editing Since the editor component can lose focus in this way, the edited values should be explicitly committed or reverted. |
Ah, I see! That makes sense. I actually forked the CodeSandbox from the issue template, and it seems the version specified there is quite old. I didn’t realize it was outdated. |
Oh, good to know. Thanks, I'll update that too. Cheers 👍🏼 |
Describe the bug
A clear and concise description of what the bug is (and how to reproduce it, if relevant)
When the user unfocuses the editor component without clicking either 'OK' or 'Cancel', the displayed value remains as entered, but the internal state is not updated.
Based on my understanding of the code, the InputButtons component should trigger either
onOK
oronCancel
when it is about to be unmounted in order to resolve this issue.json-edit-react/src/ButtonPanels.tsx
Line 198 in 31f0243
Expected behavior
Screenshots
Online demo
Please try and reproduce problem using a fork of this sandbox, and post the link here. If you can't reproduce the problem there, it's likely to be due to something outside of the component itself.
The text was updated successfully, but these errors were encountered: