-
Notifications
You must be signed in to change notification settings - Fork 801
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 read property 'propTypes' of undefined at updateMemoComponent #1230
Comments
Seems like what's tripping it up is the |
Sorry - there is no way I could reproduce the problem, but you are trying to |
I'm facing same error when using react.memo!
Not exactly... debugger says: updateMemoComponent(/*...*/) {
// ...
var _type = Component.type; // <-- Component is a function and has no type!
var _innerPropTypes = _type.propTypes; // <-- _type is undefined
if (_innerPropTypes) {
// Inner memo component props aren't currently validated in createElement.
// We could move it there, but we'd still need this for lazy code path.
checkPropTypes(_innerPropTypes, nextProps, // Resolved props
'prop', getComponentName(_type), getCurrentFiberStackInDev);
}
} For some components it works, but for others - fails. Maybe it depends when memoized component is being used directly with some other HOC. In my case: WithContext is a HOC, WorstInstruments is a memoized component And I'm always getting hot-update error. // withContext
*
* @param {React.Context<any>} Context
* @param [opts = {}]
* @param [opts.mergeProps]
* @returns {function(React.ComponentType<any>): React.ComponentType<any>}
*/
const withContext = (Context, opts = {}) => WrappedComponent => {
const { mergeProps = defaultMergeProps } = opts;
function WithContext(props) {
return (
<Context.Consumer>
{ctx => {
const propsToWrapped = mergeProps(ctx, props);
return <WrappedComponent {...propsToWrapped} />;
}}
</Context.Consumer>
);
}
return hoistNonReactStatics(WithContext, WrappedComponent);
}; |
Probably I've found a problem. There are two different "memo" components - a MemoComponent, and SimpleMemoComponent. RHL works for the second one, breaks for the first. I don't get yet, where which one is used(and how to create a test for it), but it's clear how I am breaking it |
This issue should be solved simultaneously with #1135, ie since v4.6.3. I am trying to write a failing test, or at least some example to play with, not it always works :(
|
v4.8.5 should fix this |
Description
Started seeing this one last night, I need to try and isolate it a bit more.
Actual behavior
Getting this error. Specifically, it seems to have after the second save on a certain page. Never the first save, and other pages are working normally.
Environment
React Hot Loader version: 4.8.4
Have the
@hot-loader
dom patch, and the following settings:The page that it's running on is a bit large, I'll just paste it here anyway:
The text was updated successfully, but these errors were encountered: