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 incompatibility of TimePicker with Preact #1

Closed
wants to merge 1 commit into from

Conversation

louisremi
Copy link
Owner

I managed to get react-toolbox to work with Preact (which was mostly a matter of customizing the Webpack config).
I've got one remaining problem that is due to some internal differences between React and Preact VDom libraries. From what I've gathered, components should avoid using node references is componentDidMount or componentDidUpdate without wrapping them in a setImmediate or setTimeout(…, 0) (see preactjs/preact#477 ).

With the current logic of componentDidUpdate in TimePickerDialog.js, the component throws a TypeError: Cannot read property 'handleCalculateShape' of undefined and interaction is impossible:
image

Fixing this in Preact seems like a difficult if not impossible task, however fixing it in the TimePicker component is only a matter of wrapping the call to this.clockNode.handleCalculateShapein an arrow function so that this.clockNode is not accessed immediately on component update.

Let me know if the change is acceptable :-)

I managed to get react-toolbox to work with Preact (which was mostly a matter of customizing the Webpack config).
I've got one remaining problem that is due to some internal differences between React and Preact VDom libraries. From what I've gathered, components should avoid using node references is componentDidMount or componentDidUpdate without wrapping them in a `setImmediate` or `setTimeout(…, 0)` (see preactjs/preact#477 ).

With the current logic of componentDidUpdate in TimePickerDialog.js, the component throws a `TypeError: Cannot read property 'handleCalculateShape' of undefined` and interaction is impossible:


Fixing this in Preact seems like a difficult if not impossible task, however fixing it in the TimePicker component is only a matter of wrapping the call to `this.clockNode.handleCalculateShape`in an arrow function so that this.clockNode is not accessed immediately on component update.

Let me know if the change is acceptable :-)
@louisremi louisremi closed this Aug 3, 2017
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.

1 participant