Closed davidblurton closed 8 years ago
Tests pass but error with
Error:
Zuul tried to run tests in saucelabs, however no saucelabs credentials were provided.
See the zuul wiki (https://github.com/defunctzombie/zuul/wiki/Cloud-testing) for info on how to setup cloud testing.
@davidblurton Interesting approach to solving #73.
Have you considered simply checking for isReactComponent
property? It was sugggested here:
https://discuss.reactjs.org/t/how-to-determine-if-js-object-is-react-component/2825/5
The property isReactComponent
doesn't seem to be defined on ES6 classes.
To check for classes you'd have to do React.Component.isPrototypeOf(object)
but that involves taking a dependency on react
.
You are right, React elements no longer can be detected by a simple property check.ยน Your approach seems to be the correct way. It's even mentioned in "React Components, Elements, and Instances" blog post:
All React elements require an additional
$$typeof: Symbol.for('react.element')
field declared on the object for security reasons.
ยน _isReactElement
property was removed, at the same time as $$typeof
was introduced - before React v0.14.0-rc1.
I've added some tests for React elements and components. This along with the cycle detection should make things a lot smoother.
One problem I had was that the property that causes the issue, _owner
, isn't filled in until the component is mounted in the dom. In other words, I was unable to reproduce the stack overflow in my tests. Instead I tested that React elements and components aren't modified.
CI build still failing with Zuul error.
๐ ๐ ๐ Thanks a ton @davidblurton!!!
Fixes #73
Allows you to map from an immutable to a React element.