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

Fix a bug in DatePicker when using valueLink #1400

Merged
merged 1 commit into from
Aug 18, 2015

Conversation

leesiongchan
Copy link

This fix will remove valueLink to avoid Invariant Violation: Cannot provide a valueLink and a value or onChange event. If you want to use value or onChange, you probably don't want to use valueLink.

// Removes valueLink to avoid `Invariant Violation: Cannot provide a valueLink
// and a value or onChange event. If you want to use value or onChange, you
// probably don't want to use valueLink.`
if (other.valueLink) delete other.valueLink;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better way to do this would be to add valueLink inside the spread operator. However, in looking at the code, I don't think this component is handling valueLink properly since it should return the date as the first parameter in the onChange callback. Also, it should call valueLink.requestChange. This will have to be addressed in a separate PR.

This fix will remove valueLink to avoid `Invariant Violation: Cannot provide a valueLink and a value or onChange event. If you want to use value or onChange, you probably don't want to use valueLink.`
@leesiongchan
Copy link
Author

Updated.

hai-cea added a commit that referenced this pull request Aug 18, 2015
Fix a bug in DatePicker when using valueLink
@hai-cea hai-cea merged commit 7949547 into mui:master Aug 18, 2015
@hai-cea
Copy link
Member

hai-cea commented Aug 18, 2015

Thanks @ahlee2326

@ee7klt
Copy link

ee7klt commented Dec 11, 2015

is this related to the error I'm getting when trying to define requestChange on datepicker? the error i'm getting is this.props.valueLink.requestChange is not a function. Just curious, why wouldn't i want to use valueLink access changes like I can do in most of the other components? I've used valueLink successfully on selectField and textField.

screen shot 2015-12-11 at 1 02 39 pm
screen shot 2015-12-11 at 1 02 49 pm
screen shot 2015-12-11 at 1 02 54 pm
screen shot 2015-12-11 at 1 01 21 pm

@zannager zannager added component: date picker This is the name of the generic UI component, not the React module! component: pickers This is the name of the generic UI component, not the React module! labels Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: date picker This is the name of the generic UI component, not the React module! component: pickers This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants