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

Support Preact X #6

Open
lydell opened this issue Oct 5, 2019 · 2 comments · May be fixed by #7
Open

Support Preact X #6

lydell opened this issue Oct 5, 2019 · 2 comments · May be fixed by #7

Comments

@lydell
Copy link

lydell commented Oct 5, 2019

  • this.base is undefined at componentDidMount, so this.shadow never gets initialized.
  • props.children[0] is undefined, since children isn’t always an array anymore.
  • The third argument to render() should be removed, as per the Preact X upgrade docs.

I run the following replacements on my bundle as a workaround:

    // Hacks to make `preact-shadow-root` work with Preact 10.
    "this.base&&this.base.parentNode": "this.__P",
    "o.children[0],": "o.children,",
    "this.shadow.firstChild": "undefined",
@developit
Copy link
Owner

Sorry for not seeing this!

I think actually the first replacement (this.__P) should no longer be necessary in the latest version of Preact 10. The children one is definitely needed though, and the third argument to render can be removed.

@developit developit linked a pull request Mar 3, 2020 that will close this issue
@albv
Copy link

albv commented Jun 9, 2021

@developit I just tried this and it seems that the first replacement (this.__P) is still required in the latest version of Preact. If render method doesn't return something actually "renderable" this.base would be undefined at componentDidMount. Do you have any suggestions how to make it work without using this.__P?

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 a pull request may close this issue.

3 participants