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

Using webComponentConstructed causes type error: cannot read property webComponentAttributeChanged of undefined #8

Open
idsvanderzee opened this issue Feb 28, 2018 · 1 comment

Comments

@idsvanderzee
Copy link

When using the webComponentConstructed lifecycle hook to get a reference to the component once it is constructed an error is thrown on line 32 of index.js. The webComponentConstructed function works as intended, but having this error apear in the console is not desirable.

@Shipuli
Copy link

Shipuli commented Aug 24, 2018

I also ran into this and haven't found a satisfying workaround yet. This error (probably) does not come from the webComponentConstructed, but the whole implementation itself. At least in my case, this error (probably) comes from the parent site giving attributes to the component before the component has been fully rendered. The error happens because appInstance (your react class) is defined after the component has been fully rendered (asynchronous rendering in index.js line 48) but the callback methods are immediately available (because they are defined this way).

In this case removing the webComponentConstructed method probably makes the rendering slightly faster allowing it to finish before the attributes are passed to component leading to this kind of behaviour. Or at least this is how it seems to me.

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

No branches or pull requests

2 participants