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

Cannot read property 'parentElement' of undefined - Errors with Preact@8.x #56

Open
rubencodes opened this issue Apr 18, 2017 · 2 comments
Labels

Comments

@rubencodes
Copy link
Contributor

I've been having some issues using this with the latest Preact; I was getting similar warnings on 7.x but now it's flat-out not working.

screen shot 2017-04-17 at 10 54 49 pm

screen shot 2017-04-17 at 10 55 28 pm

At the risk of providing a red-herring: I have a branch of my project that uses preact-router instead of react-router, and it seems to work just fine there? Not sure what gives...

@rubencodes rubencodes changed the title Issues with Preact@8.x Cannot read property 'parentElement' of undefined - Errors with Preact@8.x Apr 18, 2017
@developit
Copy link
Owner

developit commented Apr 18, 2017

The preact-router swap is an interesting data point. Maybe something is being removed immediately after state is being mutated on it?

If this.container is a ref, perhaps in prior versions of preact were re-calling the ref with a different element from a new route, and that is no longer happening in 8? If so, we could just change the ref handling to ignore null values:

containerRef = el => {
  if (el!=null) this.container = el;
};

Not the best for memory, but it would mean the ref is still around during unmounts.

@Arkady-Skvortsov
Copy link

Oh, thanks pal

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

No branches or pull requests

4 participants