-
Notifications
You must be signed in to change notification settings - Fork 318
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
Incorrect behaviour when using super.update()
as shown in the documentation.
#1085
Comments
This is caused by bad TypeScript compiler settings in webcomponents.dev which is triggering this TypeScript bug: microsoft/TypeScript#35081 The solution is to turn off |
Hopefully that's fixed in TypeScript 4.1. In the mean time let's track in #855 |
Here's a working example: https://webcomponents.dev/edit/ZVhx2rKR4v6RP43I1rdl. |
Hi @jandreola Your live demo uses a If you want to use Typescript, just rename the file to we use
@gluck found that If you change babel options to:
Then the scenario works 👍 This can be done on webcomponents.dev here: @team polymer, What babel options should be used for JavaScript LitElement with decorators? |
@georges-gomes good catch, I didn't notice that the discussion steered towards TS and the example was plain JS. Thank you. Since TS and Babel causes issues with some default configs, should we warn people somewhere about it? It doesn't seem like an edge case. I also found that unit tests in Lit do call |
Oh, I'm sorry. I saw decorators and assumed TypeScript. We don't have too many people using decorators with Babel. @georges-gomes this is the .babelrc we use in our tests: https://github.com/Polymer/lit-element/blob/master/.babelrc It uses the formerly "stage 2" decorators, not legacy decorators. |
@justinfagnani ok thanks! We will update on our side accordingly. |
Description
The documentation and many examples shows that
super.update()
should be placed at the top when overriding theupdate
method.But if we update any observed property after calling
super.update()
none of the changes will reflect on the next render.Live Demo
https://webcomponents.dev/edit/gCiSmxIqNaCBLZTOWlJv
In the demo you can uncomment the
super.update
at the end and you will see it working correctly.Steps to Reproduce
Expected Results
Documentation should clarify that in order to work as expected
super.update()
must be called after any updates to observed propertiesActual Results
Documentation is not clear / misleading on where
super.update
should be calledBrowsers Affected
Versions
The text was updated successfully, but these errors were encountered: