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

[Slider] fix Slider.jsx wrong props.value check #1251

Merged
merged 3 commits into from
Jul 28, 2015
Merged

[Slider] fix Slider.jsx wrong props.value check #1251

merged 3 commits into from
Jul 28, 2015

Conversation

micaste
Copy link
Contributor

@micaste micaste commented Jul 23, 2015

No description provided.

@@ -78,8 +78,7 @@ let Slider = React.createClass({
},

getInitialState() {
let value = this.props.value;
if (value === null) value = this.props.defaultValue;
let value = this.props.value || this.props.defaultValue || 0;
Copy link
Member

Choose a reason for hiding this comment

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

const?

@@ -94,7 +93,7 @@ let Slider = React.createClass({
},

componentWillReceiveProps(nextProps) {
if (nextProps.value !== null) {
if (!nextProps.value) {
Copy link
Member

Choose a reason for hiding this comment

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

Does this break if nextProps.value === 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, and it is kind of problematic for the value field.
But then I was wondering, why did you guys have a check for null? Because to me, if no value is sent in a prop, it will always be undefined.
Would there be a problem in doing :

nextProps.value !== undefined

everywhere ?

Copy link
Member

Choose a reason for hiding this comment

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

I don't see a problem with your fix. This was probably a bug that's been in this component from the beginning.

hai-cea added a commit that referenced this pull request Jul 28, 2015
[Slider] fix Slider.jsx wrong props.value check
@hai-cea hai-cea merged commit 14d80ee into mui:master Jul 28, 2015
@hai-cea
Copy link
Member

hai-cea commented Jul 28, 2015

Thanks @micaste

@zannager zannager added the component: slider This is the name of the generic UI component, not the React module! label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: slider 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.

None yet

4 participants