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

suspense fix: Cannot read property 'insertBefore' of undefined #4141

Merged
merged 3 commits into from
Sep 24, 2023

Conversation

zakstucke
Copy link
Contributor

@zakstucke zakstucke commented Sep 24, 2023

Please see #3149 & #3105 for context.

Migrating from React to Preact, our suspense boundaries are failing everywhere with this problem still on latest Preact.

Looking into those specific issues and not finding a solution that worked, I delved into the suspense.js file and played around. The only solution I could find was adding a check for originalParent at the top level of removeOriginal().

I've created a test from the repro in #3149, their way was the only way i could find to simply reproduce.

The change to suspense.js fixes the test.

I'm currently patching preact dist code with this change to make our app work, if this change is wrong and can't be merged, any way of getting round the problem would be greatly appreciated, it's the only thing I've found to work!

@coveralls
Copy link

coveralls commented Sep 24, 2023

Coverage Status

coverage: 99.294%. remained the same when pulling b319cc6 on zakstucke:main into 64be3cb on preactjs:main.

Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! Thanks for making a PR for this 👍

@marvinhagemeister marvinhagemeister merged commit b7629b0 into preactjs:main Sep 24, 2023
3 checks passed
@zakstucke
Copy link
Contributor Author

zakstucke commented Sep 24, 2023

Awesome thanks @marvinhagemeister! Nice to see you managed to understand cause and make the test more clear 🎉

@JoviDeCroock JoviDeCroock mentioned this pull request Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants