Move style gathering from class finalization to initialization#866
Move style gathering from class finalization to initialization#866
Conversation
|
Also fixed a few formatting issues. |
|
IMO, this is a breaking change. As an example, we are using Would it be possible to keep @dfreedm @justinfagnani WDYT? |
|
@web-padawan |
|
@justinfagnani thanks for pointing out. FWIW, we currently rely on static _includeStyle(moduleName: string) {
// Hack to bypass TypeScript private property check
// eslint-disable-next-line dot-notation
this['_styles'].push(unsafeCSS(cssFromModule(moduleName)));
}So I will have to adjust that to use But then again, we can't modify Can you consider the following changes in scope of this PR?
Either option should work for our case.
|
|
@web-padawan this is the code in question, yeah? https://github.com/vaadin/component-mixins/blob/f0e0f1953a2cd2d937d91ca7311e34cf784157f4/packages/themable-element/themable-element.ts#L31 Taking a look now.... |
|
Also, @aomarks do you know why the Tachometer tests are stuck? |
|
By moving style gathering to initialization, stylesheets will only be created for elements that have booted, and not for elements that have only be registered. This should be performance positive for applications with less than ideal loading behaviors.
2cf1bab to
2f4151e
Compare
|
Rebased with #868 |
Override `getStyles()` to integrate a style injection system.
|
Apologies for the delay, dropped the ball on this after the Holiday break. |
justinfagnani
left a comment
There was a problem hiding this comment.
Still LGTM!
@web-padawan hows this look to you? You'd override getStyles().
|
|
||
| ### Fixed | ||
| * Properties annotated with the `eventOptions` decorator will now survive property renaming optimizations when used with tsickle and Closure JS Compiler. | ||
| * Moved style gathering from `finalize` to `initialize` to be more lazy, and create stylesheets on the first instance initializing [#866](https://github.com/Polymer/lit-element/pull/866). |
There was a problem hiding this comment.
Do you think it makes sense to add statis getStyles() mention to "Added"?
By moving style gathering to initialization, stylesheets will only be
created for elements that have booted, and not for elements that have
only be registered.
This should be performance positive for applications with less than
ideal loading behaviors.
Fixes #870