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

[lit-ssr] Initial commit of lit-ssr package #1347

Merged
merged 47 commits into from
Oct 30, 2020
Merged

Conversation

kevinpschaaf
Copy link
Member

@kevinpschaaf kevinpschaaf commented Oct 3, 2020

Port of SSR implementation from proof-off-concept work in lit-ssr repo, lit-html#hydration branch, and lit-element#hydration branch.

Current status:

  • Server-only render-lit-html tests passing
  • lit-html integration tests passing
  • LitElement integration tests passing
    • renderLight directive implemented / tests passing
  • SSR unit/integration passing on CI

Note that the work under #1360 (additional fixes/features for end-to-end app proof-of concept) will be done in a follow-on PR.


Current size comparison: (as of b3c0d39)

Name                            Size      Minified  Gzipped  Brotli   
----------------------------------------------------------------------
lit-html.js  (lit-next)         6.41 KB   6.41 KB   2.81 KB  2.55 KB  
lit-html.js  (lit-next-ssr)     6.76 KB   6.76 KB   2.96 KB  2.67 KB (+150b gzip)

hydrate.js                      2.79 KB   2.79 KB   1.29 KB  1.15 KB  
private-ssr-support.js           168 B     167 B     159 B    127 B    

lit-element.js (lit-next)        694 B     693 B     394 B    330 B    
lit-element.js (lit-next-ssr)    810 B     809 B     431 B    372 B  (+37b gzip)   

hydrate-support.js               387 B     386 B     222 B    177 B   

Notes for reviewers:

  • The first commit was a copy/paste of lit-ssr and hydrate.ts from the POC repo/branches, so https://github.com/Polymer/lit-html/compare/938459a..b3c0d39 will compare from that baseline forward to just before the formatting changes added at the end that make it much more difficult to diff

  • lit-html

    • Added export const $private = { ... } export to lit-html which exports private top-level members needed by hydrate & render-lit-html as mangled names, which both keeps file size down and reinforces private nature of them
    • Added private-ssr-support.js module which re-exports the fields in $private back to well-known symbol names for use in lit-ssr, so that package is agnostic to whether the lit packages are in dev or prod mode
    • Added renderLight under lit-html /directives; we had this in LitElement, but it's not really LitElement-specific per se, and it fits better under lit-html directives than as a one-off under LitElement
    • During hydration, we need to construct a NodePart before we've reached its end marker; for now I've added a _setEndNode method rather than make _endNode public; TBD
    • In order to reuse the non-trivial AttributePart logic for running directives on all of the parts and concatenating everything together, I factored _resolveValue out of _setValue, so that we can call that during hydrate and on the server without committing the value to the DOM. However, as part of that we need to do the server thing with directives, aka run its render not its update. In order to reuse the AttributePart logic, I made Directive have a patchable resolve method that defaults to running update but which can be patched by SSR to run render instead. This is maybe one of the more questionable changes. TBD
  • lit-element

    • Added hydrate-support.js module which installs the hydrate codepath into LitElement
    • Adds _renderImpl to LitElement as a patching point for hydrate-support (similar to the old static render method, but internal and on the prototype)
  • template-shadowroot

    • For now, I'm depending on the github repo and building it package from source as part of the lit-ssr build script since it's not released. We should discuss whether to publish a release yet or not.
  • lit-ssr

@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2020

📊 Tachometer Benchmark Results

Summary

  • lit-element-stub1

nop-update

  • lit-html-kitchen-sink: unsure 🔍 -4% - +3% (-1.45ms - +1.25ms)
    this-change vs tip-of-tree

render

  • lit-element-list: faster ✔ 1% - 2% (0.64ms - 2.31ms)
    this-change vs tip-of-tree
  • lit-html-kitchen-sink: unsure 🔍 -2% - +1% (-0.69ms - +0.38ms)
    this-change vs tip-of-tree
  • lit-html-repeat: unsure 🔍 -1% - +1% (-0.17ms - +0.17ms)
    this-change vs tip-of-tree
  • lit-html-template-heavy: slower ❌ 2% - 4% (1.25ms - 3.07ms)
    this-change vs tip-of-tree
  • updating-element-list: unsure 🔍 -2% - +1% (-1.03ms - +0.32ms)
    this-change vs tip-of-tree

update

  • lit-element-list: unsure 🔍 -0% - +1% (-3.91ms - +9.58ms)
    this-change vs tip-of-tree
  • lit-html-kitchen-sink: slower ❌ 1% - 7% (0.70ms - 7.62ms)
    this-change vs tip-of-tree
  • lit-html-repeat: unsure 🔍 -2% - +0% (-6.80ms - +1.17ms)
    this-change vs tip-of-tree
  • lit-html-template-heavy: unsure 🔍 -2% - +1% (-3.16ms - +1.04ms)
    this-change vs tip-of-tree
  • updating-element-list: unsure 🔍 -2% - +2% (-2.71ms - +2.17ms)
    this-change vs tip-of-tree

update-reflect

  • lit-element-list: unsure 🔍 -0% - +1% (-3.89ms - +11.30ms)
    this-change vs tip-of-tree
  • updating-element-list: unsure 🔍 -1% - +1% (-2.77ms - +1.51ms)
    this-change vs tip-of-tree

Results

lit-element-list

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
106.42ms - 107.54ms-faster ✔
1% - 2%
0.64ms - 2.31ms
faster ✔
22% - 24%
30.62ms - 32.89ms
tip-of-tree
tip-of-tree
107.84ms - 109.08msslower ❌
1% - 2%
0.64ms - 2.31ms
-faster ✔
21% - 23%
29.11ms - 31.44ms
previous-release
previous-release
137.75ms - 139.72msslower ❌
29% - 31%
30.62ms - 32.89ms
slower ❌
27% - 29%
29.11ms - 31.44ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
981.98ms - 992.13ms-unsure 🔍
-0% - +1%
-3.91ms - +9.58ms
faster ✔
8% - 9%
81.01ms - 94.16ms
tip-of-tree
tip-of-tree
979.78ms - 988.66msunsure 🔍
-1% - +0%
-9.58ms - +3.91ms
-faster ✔
8% - 9%
84.32ms - 96.52ms
previous-release
previous-release
1070.45ms - 1078.83msslower ❌
8% - 10%
81.01ms - 94.16ms
slower ❌
9% - 10%
84.32ms - 96.52ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
1095.12ms - 1106.70ms-unsure 🔍
-0% - +1%
-3.89ms - +11.30ms
faster ✔
3% - 5%
36.51ms - 52.19ms
tip-of-tree
tip-of-tree
1092.29ms - 1102.13msunsure 🔍
-1% - +0%
-11.30ms - +3.89ms
-faster ✔
4% - 5%
40.83ms - 55.27ms
previous-release
previous-release
1139.98ms - 1150.54msslower ❌
3% - 5%
36.51ms - 52.19ms
slower ❌
4% - 5%
40.83ms - 55.27ms
-
lit-html-kitchen-sink

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
43.71ms - 44.24ms-unsure 🔍
-2% - +1%
-0.69ms - +0.38ms
faster ✔
20% - 24%
10.83ms - 13.81ms
tip-of-tree
tip-of-tree
43.67ms - 44.59msunsure 🔍
-1% - +2%
-0.38ms - +0.69ms
-faster ✔
19% - 24%
10.63ms - 13.71ms
previous-release
previous-release
54.83ms - 57.76msslower ❌
25% - 31%
10.83ms - 13.81ms
slower ❌
24% - 31%
10.63ms - 13.71ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
112.03ms - 117.73ms-slower ❌
1% - 7%
0.70ms - 7.62ms
unsure 🔍
-4% - +2%
-4.75ms - +2.40ms
tip-of-tree
tip-of-tree
108.76ms - 112.68msfaster ✔
1% - 7%
0.70ms - 7.62ms
-faster ✔
2% - 7%
2.43ms - 8.25ms
previous-release
previous-release
113.90ms - 118.21msunsure 🔍
-2% - +4%
-2.40ms - +4.75ms
slower ❌
2% - 8%
2.43ms - 8.25ms
-

nop-update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
38.48ms - 40.28ms-unsure 🔍
-4% - +3%
-1.45ms - +1.25ms
faster ✔
4% - 13%
1.50ms - 5.83ms
tip-of-tree
tip-of-tree
38.47ms - 40.49msunsure 🔍
-3% - +4%
-1.25ms - +1.45ms
-faster ✔
3% - 13%
1.35ms - 5.78ms
previous-release
previous-release
41.07ms - 45.01msslower ❌
4% - 15%
1.50ms - 5.83ms
slower ❌
3% - 15%
1.35ms - 5.78ms
-
lit-html-repeat

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
13.81ms - 14.02ms-unsure 🔍
-1% - +1%
-0.17ms - +0.17ms
faster ✔
19% - 21%
3.22ms - 3.57ms
tip-of-tree
tip-of-tree
13.79ms - 14.05msunsure 🔍
-1% - +1%
-0.17ms - +0.17ms
-faster ✔
19% - 21%
3.20ms - 3.59ms
previous-release
previous-release
17.17ms - 17.45msslower ❌
23% - 26%
3.22ms - 3.57ms
slower ❌
23% - 26%
3.20ms - 3.59ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
424.36ms - 429.75ms-unsure 🔍
-2% - +0%
-6.80ms - +1.17ms
faster ✔
30% - 32%
186.42ms - 198.29ms
tip-of-tree
tip-of-tree
426.94ms - 432.80msunsure 🔍
-0% - +2%
-1.17ms - +6.80ms
-faster ✔
30% - 31%
183.50ms - 195.58ms
previous-release
previous-release
614.13ms - 624.70msslower ❌
44% - 47%
186.42ms - 198.29ms
slower ❌
43% - 46%
183.50ms - 195.58ms
-
lit-html-template-heavy

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
77.71ms - 79.03ms-slower ❌
2% - 4%
1.25ms - 3.07ms
faster ✔
15% - 18%
14.12ms - 16.71ms
tip-of-tree
tip-of-tree
75.58ms - 76.84msfaster ✔
2% - 4%
1.25ms - 3.07ms
-faster ✔
18% - 20%
16.29ms - 18.86ms
previous-release
previous-release
92.66ms - 94.90msslower ❌
18% - 21%
14.12ms - 16.71ms
slower ❌
21% - 25%
16.29ms - 18.86ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
167.27ms - 170.44ms-unsure 🔍
-2% - +1%
-3.16ms - +1.04ms
faster ✔
12% - 14%
23.40ms - 27.87ms
tip-of-tree
tip-of-tree
168.53ms - 171.29msunsure 🔍
-1% - +2%
-1.04ms - +3.16ms
-faster ✔
12% - 14%
22.49ms - 26.67ms
previous-release
previous-release
192.91ms - 196.06msslower ❌
14% - 17%
23.40ms - 27.87ms
slower ❌
13% - 16%
22.49ms - 26.67ms
-
updating-element-list

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
58.73ms - 59.49ms-unsure 🔍
-2% - +1%
-1.03ms - +0.32ms
unsure 🔍
-1% - +1%
-0.73ms - +0.38ms
tip-of-tree
tip-of-tree
58.91ms - 60.02msunsure 🔍
-1% - +2%
-0.32ms - +1.03ms
-unsure 🔍
-1% - +1%
-0.51ms - +0.86ms
previous-release
previous-release
58.89ms - 59.69msunsure 🔍
-1% - +1%
-0.38ms - +0.73ms
unsure 🔍
-1% - +1%
-0.86ms - +0.51ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
129.14ms - 133.12ms-unsure 🔍
-2% - +2%
-2.71ms - +2.17ms
unsure 🔍
-2% - +2%
-2.55ms - +2.44ms
tip-of-tree
tip-of-tree
129.99ms - 132.81msunsure 🔍
-2% - +2%
-2.17ms - +2.71ms
-unsure 🔍
-1% - +2%
-1.85ms - +2.27ms
previous-release
previous-release
129.68ms - 132.69msunsure 🔍
-2% - +2%
-2.44ms - +2.55ms
unsure 🔍
-2% - +1%
-2.27ms - +1.85ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
207.99ms - 211.22ms-unsure 🔍
-1% - +1%
-2.77ms - +1.51ms
unsure 🔍
-0% - +2%
-0.47ms - +3.55ms
tip-of-tree
tip-of-tree
208.84ms - 211.64msunsure 🔍
-1% - +1%
-1.51ms - +2.77ms
-slower ❌
0% - 2%
0.34ms - 4.01ms
previous-release
previous-release
206.88ms - 209.26msunsure 🔍
-2% - +0%
-3.55ms - +0.47ms
faster ✔
0% - 2%
0.34ms - 4.01ms
-

tachometer-reporter-action v2 for Benchmarks

@kevinpschaaf kevinpschaaf force-pushed the lit-next-ssr branch 2 times, most recently from 6453779 to 4c586dc Compare October 14, 2020 06:44
Fix lit-element import paths

For now, build template-shadowroot as part of lit-ssr

Add lit-ssr tests to CI

Fix merge error (Template:_options)

Remove tsconfig.tsbuildinfo

Uncomment element tests ffrom server-only suite

Fix return value of createRenderRoot patch
Rename $litPrivate -> $private

Fix demo hydration

README updates
});
// There will be two comments per part (open+close) in the rendered
// output and on the client, so increment again for that
// nodeIndex++;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to confirm why this is no longer true, but likely due to the client-side change to only make one marker for node parts.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

abstract render(...props: Array<unknown>): unknown;
update(_part: Part, props: Array<unknown>): unknown {
return this.render(...props);
}
}

const getTemplateHtml = (strings: TemplateStringsArray, type: ResultType) => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just broken out of the constructor, for use by render-lit-html.

@@ -319,15 +322,156 @@ const walker = d.createTreeWalker(
* change in future pre-releases.
*/
export abstract class Directive {
resolve(part: Part, props: Array<unknown>): unknown {
return this.update(part, props);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to reuse the non-trivial AttributePart logic for running directives on all of the parts and concatenating everything together, I factored _resolveValue out of _setValue, so that we can call that during hydrate and on the server without committing the value to the DOM. However, as part of that we need to do the server thing with directives, aka run its render not its update. In order to reuse the AttributePart logic, I made Directive have a patchable resolve method that defaults to running update but which can be patched by SSR to run render instead. We can't just patch update because the user overrides this method. This is maybe one of the more questionable changes. TBD

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to _resolve and make private?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (it's @internal, not private)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without having thought too hard about his yet, I'd be a little inclined to see if we can vary the callsite for directive.update() instead.

/** @internal */
_setEndNode(node: ChildNode | null) {
this._endNode = node;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During hydration, we need to construct a NodePart before we've reached its end marker; for now I've added a _setEndNode method rather than make _endNode public; TBD

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think _startNode and _endNode should just be @internal.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless we do a rollup build for SSR (which we discussed in chat and decided to go the private-support approach for top-level exports), any mangled fields of those members still hit the issue, and need to be in the reserved list (not the cross-package mangle list). So they're both not hidden and not mangled. It's just a choice we need to decide on and then be consistent.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I take that back, _startNode/_endNode are only used in hydrate, which can be mangled, so I'll go for that.

"description": "",
"main": "index.js",
"scripts": {
"build": "(cd node_modules/template-shadowroot && npm run build) && tsc",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, I'm depending on the github repo for template-shadowroot and building it package from source as part of the lit-ssr build script since it's not released. We should discuss whether to publish a release yet or not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless something has changed recently with the spec'd feature that requires the package to be updated, I think we should release it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. We can do a pre-release version for now.

@kevinpschaaf kevinpschaaf marked this pull request as ready for review October 16, 2020 09:27
Return `noChage` from default render now that we don't clear the container before rendering, which was the reason for renderNotImplemented.
@kevinpschaaf
Copy link
Member Author

@justinfagnani @sorvell I think I addressed most of the feedback in here, PTAL.

new (...args: any[]): PatchableLitElement;
createRenderRoot(): Element | ShadowRoot;
_needsHydration: boolean;
_renderImpl(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

packages/lit-html/src/hydrate.ts Show resolved Hide resolved
(container as any).$lit$ = rootPart;
};

const openNodePart = (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain that after calling hydrate lit-html will behave as if it just initially rendered that DOM and any subsequent renders will update efficiently, the same as if lit-html had rendered the DOM on the client.

packages/lit-html/src/hydrate.ts Outdated Show resolved Hide resolved
packages/lit-ssr/src/lib/render-lit-html.ts Show resolved Hide resolved
packages/lit-ssr/src/lib/render-lit-html.ts Show resolved Hide resolved
packages/lit-ssr/src/lib/util/parse5-utils.ts Show resolved Hide resolved
Comment on lines +103 to +105
- name: Lint
run: npm run lint

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Lint
run: npm run lint

Now lit-next branch already has a lint step! 🙂

@kevinpschaaf
Copy link
Member Author

kevinpschaaf commented Oct 23, 2020

@sorvell Added comments & fixed attributePart naming. PTAL: 14837d4

@@ -139,10 +130,14 @@ export class LitElement extends UpdatingElement {
* the element to update.
*/
protected render(): unknown {
return renderNotImplemented;
return noChange;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this an intended change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, that deserves some discussion. @sorvell had suggested just re-implementing LitElement's update in hydrate-support rather than adding a patchable _renderImpl, since LitElement's update is pretty small, and that would have required exporting the renderNotImplemented symbol. But in thinking about why we had that, it was to disambiguate whether the user implemented render so that we didn't clear the light DOM if the user had not implemented render. Since we don't clear the container now, I don't think we need to treat "not implemented" special anymore, we can just return noChange to not do anything in render. Seems better?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, this was the change where renderNotImplemented was introduced: lit/lit-element#917:

lit/lit-element#712 Introduced a breaking behavior change for situations where
render is unimplemented, and DOM is added before being connected to
the document.

@@ -35,7 +35,7 @@ const markerMatch = '?' + marker;
// syntax because it's slightly smaller, but parses as a comment node.
const nodeMarker = `<${markerMatch}>`;

const d = document;
const d = window.document;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be necessary since we patch the global. Is this for the non-importModule use case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, we don't actually add the document instance to the shim. Lemme do that.

);
const walker =
d &&
d.createTreeWalker(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

d?.createWalker

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (removed, added createTreeWalker stub to shim)

@@ -319,15 +322,156 @@ const walker = d.createTreeWalker(
* change in future pre-releases.
*/
export abstract class Directive {
resolve(part: Part, props: Array<unknown>): unknown {
return this.update(part, props);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without having thought too hard about his yet, I'd be a little inclined to see if we can vary the callsite for directive.update() instead.

return {
// We don't technically need to close the SVG tag since the parser
// will handle it for us, but the SSR parser doesn't like that
html: html + strings[l] + (type === SVG_RESULT ? '</svg>' : ''),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can these names be minified?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now we don't have a great way to minify object/class fields that are used in SSR (just top-level exports via the $private export). Since this is a very private API, seems chill enough to return an array ([html, attrNames]), so I'll do that.

@@ -751,7 +784,7 @@ export class NodePart {
// TODO (justinfagnani): To support nested directives, we'd need to
// resolve the directive result's values. We may want to offer another
// way of composing directives.
this._setValue(this._directive.update(this, value.values));
this._setValue(this._directive._resolve(this, value.values));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How much benefit do you see out of reusing the part classes in their entirety? If we moved some of the methods to functions, could we use them to build SSR-specific implementations that call directive.render()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, in SSR we only construct AttributePart (the code to run the directive for NodePart is chill enough that I just copied it). For AttributePart, we basically want to reuse _resolveValue, which sequentially resolves each directive, deals with the nothing/noChange, and then concatenates the new string. Even if we made that into a function, we'd still need to thread a flag or function through to do something different on the server. Not sure that's worth it?

Copy link
Member

@sorvell sorvell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kevinpschaaf
Copy link
Member Author

Ok, so I've confirmed that any kitchen-sink-update regression is now fully explained by adding directive support to EventPart; the change below results in the benchmark coming out unsure:
image
image

We'll look into optimizing directives in a separate issue: #1398.

@@ -359,12 +357,11 @@ const createAttributeParts = (
// directive value; we only then commit that value for event/property
// parts since those were not serialized (passing `undefined` uses the
// default commitValue; passing `noOpCommit` bypasses it)
const commitValue =
const noCommit = !(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the comment above this.

@kevinpschaaf kevinpschaaf merged commit dcd088f into lit-next Oct 30, 2020
@kevinpschaaf kevinpschaaf deleted the lit-next-ssr branch October 30, 2020 16:30
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

Successfully merging this pull request may close these issues.

None yet

4 participants