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 component.__hooks might be null #3066

Closed
1 task done
johakr opened this issue Mar 14, 2021 · 5 comments
Closed
1 task done

Suspense component.__hooks might be null #3066

johakr opened this issue Mar 14, 2021 · 5 comments

Comments

@johakr
Copy link
Contributor

johakr commented Mar 14, 2021

  • Check if updating to the latest Preact version resolve the issue

Describe the bug
There seems to be a regression with lazy Suspense and hooks, triggering this error message Cannot set property __h of null, resulting in the component infinitely rendering the fallback markup.

Everything seems to work fine until preact 10.5.4. First broken version seems to be preact 10.5.5.

Changing this condition

if (component._parentDom) {

to if (component._parentDom && component.__hooks) seems to fix the issue. But I don't have enough understanding of the preact core to tell if that is the right approach & place to fix it.

To Reproduce

#2488

Expected behavior
Suspense switches out of fallback.

acid-chicken added a commit to acid-chicken/preact that referenced this issue Apr 23, 2021
@davidrhoderick
Copy link

As of 10.5.14, I get a t.__H is null error. When I downgrade to 10.5.4 it goes away.

@developit
Copy link
Member

@davidrhoderick does the error happen when you modify hook state after a component is suspended? Or is something else triggering rendering?

A few of the comments in the linked issue mention this only happens with Suspense from preact/compat, and not with ErrorBoundary/lazy from preact-iso, which makes me think it's the hook state preservation code in compat that is causing the issue.

@davidrhoderick
Copy link

It's a rather complex application so I am not able to quickly test that but I can definitely tell you that hook state is being modified in suspended components. Also suspended components load other suspended components.

@ruben-tkww
Copy link

Same issue here Cannot set property __h of null and also working fine with 10.5.4

@JoviDeCroock
Copy link
Member

This has been fixed with 10.18.1 1658d43

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.

5 participants