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

Value property changing to null does not clear Input element's text if clearOnSameDateClick is false #693

Closed
MutatedGamer opened this issue Dec 18, 2021 · 5 comments

Comments

@MutatedGamer
Copy link

MutatedGamer commented Dec 18, 2021

🐛 bug report

Description of the problem

If a SemanticDatepicker has a value property being passed in, setting the property to null does not cause the inner Input element value to change if clearOnsameDateClick is false. This results in the text not updating, even though the value of the component has been updated.

In the sandbox link below, perform the following actions:

  1. Select a date value
  2. Click the "Set to Null" button
  3. Inspect the components in React DevTools. The outer SemanticDatepicker has a correct value of null, but the inner Input has the old value.

How has this issue affected you? What are you trying to accomplish?

This is a blocker when using Formik to handle the field's value. Specifically, I am trying to have Formik "reset" the form (I have a form inside a modal and want the form to clear when the modal is opened again). Formik's resetForm() will update all the field values, giving the SemanticDatepicker a new default value of null; visually, however, the form still has the previous value.

Link to a sandbox: here

@MutatedGamer MutatedGamer changed the title Value property changing does not update Input element's text Value property changing does not update Input element's text if clearOnSameDateClick is false Dec 18, 2021
@MutatedGamer MutatedGamer changed the title Value property changing does not update Input element's text if clearOnSameDateClick is false Value property changing to null does not clear Input element's text if clearOnSameDateClick is false Dec 18, 2021
@MutatedGamer MutatedGamer changed the title Value property changing to null does not clear Input element's text if clearOnSameDateClick is false Value property changing to null does not clear Input element's text if clearOnSameDateClick is false Dec 18, 2021
@arthurdenner
Copy link
Owner

arthurdenner commented Jan 7, 2022

Hi @MutatedGamer!

I'm sorry for the late reply, I haven't been able to check GitHub lately.
I got a reproducible sandbox and can confirm the bug: link

I'll update here when it's fixed.

@arthurdenner
Copy link
Owner

arthurdenner commented Jan 7, 2022

I did a few changes on #706 and released 2.15.1-beta.1 so you can test it.

Let me know how it goes so I can release a stable version or fix it if needed 🙌🏽

@MutatedGamer
Copy link
Author

Hi @arthurdenner,

Thanks for the quick turnaround. I tested the beta version with my above sandbox and it seems to be fixed. I sadly had to move away from this dependency for my project because #176 is a bigger blocker. My project uses vitejs for its webpack, which results in the entire app crashing in production when you try to load a datepicker. Hope you can find time to address that bug too - I'd love to move back to this dependency since I think it looks nicer than the standard "react-datepicker" 😄

@arthurdenner
Copy link
Owner

Thanks for the feedback! Yea, I should get some time to look into that issue 😅

@arthurdenner
Copy link
Owner

Closing as the fix is now published on 2.15.2.

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

No branches or pull requests

2 participants