Conversation
…t remove shimmed adopted style sheets.
|
can you also change the base |
|
@bicknellr is this ready to go in now? |
src/lit-element.ts
Outdated
| * DOM. | ||
| * @param {TemplateResult} Template to render. | ||
| * Render method used to render the value to the element's DOM. | ||
| * @param {unknown} The value to render. |
There was a problem hiding this comment.
These need the property names as the first word following the type.
| * update. | ||
| */ | ||
| protected render(): TemplateResult|void { | ||
| protected render(): unknown { |
There was a problem hiding this comment.
Can you elide the return if you type this as unknown|void?
There was a problem hiding this comment.
Doesn't seem like it:
src/lit-element.ts:241:23 - error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value.
241 protected render(): unknown|void {
~~~~~~~~~~~~
There was a problem hiding this comment.
It's a shame to add non-observable, non-type annotation code to satisfy the type-checker. Can we cast our way out of this?
There was a problem hiding this comment.
I don't know how I would cast the function in place since class syntax isn't expression based (and I assume we don't want to bind it / remove it from the prototype by making it a property), so I tried pulling it out of the class as this:
LitElement.prototype.render = function() {} as () => unknown;But then I get another couple of errors that seem like TS is no longer recognizing that render is also on the prototype:
src/lit-element.ts:219:18 - error TS2576: Property 'render' is a static member of type 'LitElement'
219 this.render(),
~~~~~~
src/lit-element.ts:243:22 - error TS2576: Property 'render' is a static member of type 'LitElement'
243 LitElement.prototype.render = function() {} as () => unknown;
~~~~~~
I'm not familiar with pre-classes TS, so maybe that's not the right way to do it?
There was a problem hiding this comment.
(from offline) I'm going to leave the return undefined; as is and assume that any given minifier should be smart enough to remove it.
src/test/lit-element_styling_test.ts
Outdated
| assert.equal(bodyStyles, '.my-module { color: yellow; }'); | ||
| }); | ||
|
|
||
| test.only( |
|
The benchmarks check is stuck (it's been in the 'queued' state all weekend) but I don't know how to restart it. (I already tried clicking "Re-run all checks" under "Tachometer Benchmarks" in the Checks tab.) |
|
#618 is extremely serious since it affects FireFox and Safari (and others), that's over 20% of the total market share! Please expedite this PR!!! |
- #712 Introduced a breaking behavior change for situations where `render` is unimplemented, and DOM is added before being connected to the document.
) * Only call lit-html render if LitElement subclass implements render - #712 Introduced a breaking behavior change for situations where `render` is unimplemented, and DOM is added before being connected to the document. * update CHANGELOG * Remove `connectedCallback` in render test
|
Isn't this a breaking change? My team was not returning anything from render in our non-shadow-dom components that accept children, which would previously prevent render from happening. Now, it blows away all children of the component. I figured out a workaround, which is to return |
As of lit/lit#910,
renderaccepts any type. This PR causesLitElementto render anything returned byrender.Fixes #618, Fixes #168