-
Notifications
You must be signed in to change notification settings - Fork 35
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
Cannot convert undefined or null to object #35
Comments
I'm having the same issue using https://github.com/ethanselzer/react-image-magnify Also working in the dev build, but failing in the production one. |
Don't really understand the issue, but this fixes ethanselzer#35 by: 1. providing an empty object to Object.keys as a default 2. only emitting the event when there's actually something to send along with it This fixes an issue I was having with another component using this one (ethanselzer/react-image-magnify)
I'm having the same issue. Working on dev but not on production. |
I'm also having the same issue with react-cursor-position. Not sure what is the problem here. |
@ngerbauld Thanks @Coriou |
To get around this issue without installing a forked package, you can use diff --git a/node_modules/react-cursor-position/dist/ReactCursorPosition.js b/node_modules/react-cursor-position/dist/ReactCursorPosition.js
index 37f08a2..6ca75a5 100644
--- a/node_modules/react-cursor-position/dist/ReactCursorPosition.js
+++ b/node_modules/react-cursor-position/dist/ReactCursorPosition.js
@@ -474,7 +474,7 @@ var _class = function (_React$Component) {
}, {
key: 'getPassThroughProps',
value: function getPassThroughProps() {
- var ownPropNames = Object.keys(this.constructor.propTypes);
+ var ownPropNames = Object.keys(this.constructor.propTypes || {});
return (0, _object2.default)(this.props, ownPropNames);
}
}, {
diff --git a/node_modules/react-cursor-position/dist/es/ReactCursorPosition.js b/node_modules/react-cursor-position/dist/es/ReactCursorPosition.js
index fbde7fd..d6d4b31 100644
--- a/node_modules/react-cursor-position/dist/es/ReactCursorPosition.js
+++ b/node_modules/react-cursor-position/dist/es/ReactCursorPosition.js
@@ -441,7 +441,7 @@ var _class = function (_React$Component) {
}, {
key: 'getPassThroughProps',
value: function getPassThroughProps() {
- var ownPropNames = Object.keys(this.constructor.propTypes);
+ var ownPropNames = Object.keys(this.constructor.propTypes || {});
return omit(this.props, ownPropNames);
}
}, { |
When using "react-cursor-position": "^3.0.3", the following is the error received only on the server but not in the localhost.
react-dom.production.min.js:209 TypeError: Cannot convert undefined or null to object
at Function.keys ()
at t.value (ReactCursorPosition.js:497)
at t.value (ReactCursorPosition.js:510)
at La (react-dom.production.min.js:182)
at Da (react-dom.production.min.js:181)
at vo (react-dom.production.min.js:263)
at cu (react-dom.production.min.js:246)
at ou (react-dom.production.min.js:246)
at Zo (react-dom.production.min.js:239)
at qo (react-dom.production.min.js:230)
which is breaking the code here:
key: 'getPassThroughProps',
value: function getPassThroughProps() {
var ownPropNames = Object.keys(this.constructor.propTypes);
return omit(this.props, ownPropNames);
}
and here: var props = objectAssign({}, mapChildProps(this.state), this.getPassThroughProps());
The text was updated successfully, but these errors were encountered: