You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check if updating to the latest Preact version resolves the issue
Describe the bug
the child componet wrapped by memo function caused an error in the first render, then it's parent component caught the error and solved the error, but this child component disappears in the next render.
This is generally expected when you are using something outside of the closure. When you call memo, much like all the hooks stuff, you are leveraging the variables at that time. You can see that when you pass in causeError as a prop you won't be seeing this issue. https://codesandbox.io/s/headless-cherry-b5z3e?file=/src/index.js:82-582
the value of causeError variable is always up-to-date in each render.
when you pass in causeError as a prop, it will only make the default shouldComponentUpdate of memorized component return true, then the diff for this component can continue. it is just a kind of workaround.
Describe the bug
the child componet wrapped by memo function caused an error in the first render, then it's parent component caught the error and solved the error, but this child component disappears in the next render.
To Reproduce
The second Test component disappeared.
https://codesandbox.io/s/charming-curie-to3te?file=/src/index.js
Steps to reproduce the behavior:
Please see the demo above. It's not difficult to reproduce.
Expected behavior
all Test component should be rendered.
The text was updated successfully, but these errors were encountered: