-
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
Update related issues #977
Changes from 2 commits
b37bf12
cbc98ea
c81ca5c
9ebf0af
acea0de
56fdd05
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
const configuration = { | ||
logLevel: 'error', | ||
pureSFC: false, | ||
} | ||
|
||
export default configuration |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,8 @@ const stackReport = () => { | |
logger.warn('in', rev[0].name, rev) | ||
} | ||
|
||
const REACT_CONTEXT_CURRENT_VALUE = '_currentValue' | ||
|
||
const areNamesEqual = (a, b) => | ||
a === b || (UNDEFINED_NAMES[a] && UNDEFINED_NAMES[b]) | ||
const isReactClass = fn => fn && !!fn.render | ||
|
@@ -214,8 +216,13 @@ const mergeInject = (a, b, instance) => { | |
|
||
const transformFlowNode = flow => | ||
flow.reduce((acc, node) => { | ||
if (isFragmentNode(node) && node.props && node.props.children) { | ||
return [...acc, ...filterNullArray(asArray(node.props.children))] | ||
if (node && isFragmentNode(node)) { | ||
if (node.props && node.props.children) { | ||
return [...acc, ...filterNullArray(asArray(node.props.children))] | ||
} | ||
if (node.children) { | ||
return [...acc, ...filterNullArray(asArray(node.children))] | ||
} | ||
} | ||
return [...acc, node] | ||
}, []) | ||
|
@@ -279,6 +286,15 @@ const hotReplacementRender = (instance, stack) => { | |
|
||
// text node | ||
if (typeof child !== 'object' || !stackChild || !stackChild.instance) { | ||
if (stackChild && stackChild.children && stackChild.children.length) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a important moment, we dont log. |
||
logger.error( | ||
'React-hot-loader: reconciliation failed', | ||
'could not dive into [', | ||
child, | ||
'] while some elements are still present in the tree.', | ||
) | ||
stackReport() | ||
} | ||
return | ||
} | ||
|
||
|
@@ -296,11 +312,20 @@ const hotReplacementRender = (instance, stack) => { | |
return | ||
} | ||
|
||
if (typeof child.type !== 'function') { | ||
// React context consumer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am unsure about this. The value, stored in the |
||
if (child.type && typeof child.type === 'object' && child.type.Consumer) { | ||
next({ | ||
children: (child.props ? child.props.children : child.children[0])( | ||
child.type[REACT_CONTEXT_CURRENT_VALUE], | ||
), | ||
}) | ||
} else if (typeof child.type !== 'function') { | ||
next( | ||
// move types from render to the instances of hydrated tree | ||
mergeInject( | ||
asArray(child.props ? child.props.children : child.children), | ||
transformFlowNode( | ||
asArray(child.props ? child.props.children : child.children), | ||
), | ||
stackChild.instance.children, | ||
stackChild.instance, | ||
), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a case Fragment inside a div.