-
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
transformFlowNode does not skip null children, causing TypeError in hotReplacementRender #942
Comments
Real detective! Look like condition render in Fragment could break everything. |
Actually here we got two bugs. |
@theKashey it looks like you fixed it? Isn't it? |
@neoziro - yep, now it is fixed. |
This still happens when using Next.js: vercel/next.js#4299 The latest version of react-hot-loader does fix the error when using Fragments though. |
So just in time. |
@theKashey seems like there’s still an issue where the component gets remounted after componentdidupdate and returning null in render. Do you have any idea how to fix that? I’m checking it out myself too, but you’re definitely more known with the codebase |
Could you elaborate more, or provide some example? |
Description
What you are reporting: Hot reloading not working
Expected behavior
What you think should happen: Edited components should update
Actual behavior
What actually happens:
React-hot-loader: reconcilation failed due to error TypeError: Cannot read property 'type' of null
Environment
React Hot Loader version: 4.1.1
Reproducible Demo
I've not been able to make one, but this is what the result of
render(instance)
looks like, before it goes through totransformFlowNode
:The actual crash happens later, on the
if (_typeof(child.type) !== _typeof(stackChild.type))
check, becausechild
(the 3rd item in theReact.Fragment
) isnull
.The component that produces this tree that ultimately crashes is completely unrelated to the component that I updated to trigger the hot reload; other than sharing a distant parent component.
I believe the fix will be to also pass the
node.props.children
insidetransformFlowNode
throughfilterNullArray
, but I'm not sure it is that easy. This avoids the crash, but I still get anunable to merge
warning inside aReact.createContext
Provider
, and the edited component's rendering is not updated unless I trigger its state to change through other means. 🤔The text was updated successfully, but these errors were encountered: