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

[#352] Started fresh branch to fix #352. Updated component to allow i… #499

Merged
merged 5 commits into from Jan 20, 2017

Conversation

peeb
Copy link
Contributor

@peeb peeb commented Jan 16, 2017

…nput of zero as default value.

  • Update release notes
  • Test plan | Unit test | Integration test
  • Copyright header
  • Code formatting
  • Documentation

@@ -6,32 +6,23 @@ import SidebarControls from './SidebarControls';
import DateFormatSelect from './DateFormatSelect';

function DefaultValueInput({ defaultValue, onChange, newType }) {
const emptyValue = newType === 'number' ? 0 : '';
Copy link
Contributor

@gabemart gabemart Jan 17, 2017

Choose a reason for hiding this comment

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

This gets fed back to DefaultValueInput as defaultValue - now that it can be a number, we should probably change the propType of defaultValue from PropTypes.string to PropTypes.oneOfType([PropTypes.string, PropTypes.number]) to suppress the console warning when it's 0 (i.e. not a string)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

^^ didn't know about this. that's nice. Agreed we should definitely do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would fix the "is not a NaN" console warning messages too, I'm guessing.

Copy link
Contributor

Choose a reason for hiding this comment

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

@peeb I think if you wanted to fix the "is not a NaN" console warning, you would have to add an explicit NaN check on line 17 (i.e. (defaultValue !== null && !isNan(defaultValue) ? ...

@peeb
Copy link
Contributor Author

peeb commented Jan 19, 2017

@gabemart This is clear to re-review when you have time

@gabemart
Copy link
Contributor

lgtm 👍

@gabemart gabemart merged commit f62268c into develop Jan 20, 2017
@gabemart gabemart deleted the issue/352-allow-zero-input branch January 20, 2017 13:07
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

Successfully merging this pull request may close these issues.

None yet

3 participants