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] DateInput: isTouchDevice should only be determined in componentDidMount #336

Merged
merged 1 commit into from
Feb 23, 2017

Conversation

ljharb
Copy link
Member

@ljharb ljharb commented Feb 20, 2017

Fixes #335.

@ljharb ljharb added the semver-patch: fixes/refactors/etc Anything that's not major or minor. label Feb 20, 2017
@coveralls
Copy link

Coverage Status

Coverage remained the same at 86.839% when pulling 18a439e on fix_dateinput_server_render into d58f6a9 on master.

@ljharb ljharb requested a review from majapw February 22, 2017 04:36
Copy link
Collaborator

@majapw majapw left a comment

Choose a reason for hiding this comment

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

This is sweet. This is definitely the fix for #335. I wonder if this is also related to the problem with the Done button showing up for some people on iOS. I will clarify.

const { dateString } = this.state;
const {
dateString,
isTouchDevice: isTouch,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm confused about the need for this name change. Can't we just keep this as isTouchDevice?

Copy link
Member Author

Choose a reason for hiding this comment

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

That identifier name is already used on line 5

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see

@@ -9,5 +9,6 @@
"rules": {
"no-mixed-operators": [2, { "allowSamePrecedence": true }],
"jsx-a11y/no-static-element-interactions": 1, // TODO: enable
"react/no-did-mount-set-state": 0, // necessary for server-rendering
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we exclusively put this on the DateInput instead of as a universal exception?

Copy link
Member Author

@ljharb ljharb Feb 23, 2017

Choose a reason for hiding this comment

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

I can, but it should be a universal exception, because it's necessary for any component to be server-rendered. I need to disable this rule upstream in the airbnb config too - setState in componentDidMount is a good thing.

Copy link
Collaborator

@majapw majapw Feb 23, 2017

Choose a reason for hiding this comment

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

Really? we're fine with a double-render on first mount? I feel like that's something we should work against.

Copy link
Member Author

Choose a reason for hiding this comment

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

Every single one of airbnb's hypernova components works like that already. We can definitely strive to avoid it, but it's not possible to avoid for client-required functionality.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess that's fair, but given that this repo is small, I would prefer to turn it off on a case by case basis.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you prefer that I can do it - but we might need to make the same change in any component that has touch detection.

Copy link
Collaborator

@majapw majapw left a comment

Choose a reason for hiding this comment

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

Okeedoke.

const { dateString } = this.state;
const {
dateString,
isTouchDevice: isTouch,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see

@coveralls
Copy link

Coverage Status

Coverage remained the same at 86.839% when pulling d978e54 on fix_dateinput_server_render into 333bbe5 on master.

@ljharb ljharb merged commit 04d08d4 into master Feb 23, 2017
@ljharb ljharb deleted the fix_dateinput_server_render branch February 23, 2017 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-patch: fixes/refactors/etc Anything that's not major or minor.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants