Skip to content
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

lazy/Suspense causing re-rendering to break application #2519

Closed
mgarciamartin opened this issue May 3, 2020 · 5 comments · Fixed by #2570
Closed

lazy/Suspense causing re-rendering to break application #2519

mgarciamartin opened this issue May 3, 2020 · 5 comments · Fixed by #2570

Comments

@mgarciamartin
Copy link

Performing a re-render inside a lazy loaded component causes a TypeError. This does not happen with React's Suspense.

The error can be reproduced with the current version of Preact. The problem does not exist in the 10.0.5 version.

It seems that the problem can be related with Suspense not setting the children pointer correctly. This was addressed in the commit b0fe5e7, but with the change to version 10.1.X it was lost.

Reproduction

Codesandbox that reproduces the error in Preact:
https://codesandbox.io/s/compassionate-bell-t0vww

Same codesandbox working in React:
https://codesandbox.io/s/white-hooks-cdj8q

Steps to reproduce

Render an element inside a lazy loaded component and force a re-render.
In the sandbox there is a hook that calls setState the first time the element is loaded.

Expected Behavior

The component should be re-rendered the first time setState is called and then continue to work normally.

Actual Behavior

An error is thrown:

TypeError: Cannot set property '0' of null

@developit
Copy link
Member

I think my draft branch includes a fix for this.

@mgarciamartin
Copy link
Author

That's nice! If you want me to test it, just say the word!

@olabala
Copy link

olabala commented Jul 13, 2020

Sorry to urge u guys, but we really really really hope this issue will be released ASAP

❤️

@marvinhagemeister
Copy link
Member

@olabala We've just published 10.4.6 🎉

@olabala
Copy link

olabala commented Jul 15, 2020

@marvinhagemeister thank u so much 🤝

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants