Skip to content

[labs/ssr] Add configuration on LitElementRenderer for calling connectedCallback on LitElement subclasses - #5265

Merged
kyubisation merged 1 commit into
mainfrom
ssr-renderer-configuration
May 7, 2026
Merged

kyubisation merged 1 commit into
mainfrom
ssr-renderer-configuration

Conversation

@kyubisation

@kyubisation kyubisation commented Mar 15, 2026 •

Copy link
Copy Markdown
Contributor

This PR introduces the static property renderOptions?: ((element: LitElement) => LitElementRendererRenderOptions | undefined)[] on LitElementRenderer. This allows an easier or more fine granular configuration for which elements connectedCallback should be called or SSR should be skipped.

This PR also deprecates globalThis.litSsrCallConnectedCallback as LitElementRenderer.renderOptions is a full replacement.

Closes #5175 (more utility is planned, but that might take longer to get consensus)

@changeset-bot

changeset-bot Bot commented Mar 15, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 452cb0e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@lit-labs/ssr Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Mar 15, 2026 •

Copy link
Copy Markdown
Contributor

📊 Tachometer Benchmark Results

Summary

nop-update

  • this-change, tip-of-tree, previous-release: unsure 🔍 -7% - +6% (-0.73ms - +0.67ms)
    this-change vs tip-of-tree

render

  • this-change: 34.12ms - 35.90ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -7% - +5% (-1.14ms - +0.83ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -2% - +3% (-0.53ms - +0.98ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -4% - +1% (-3.85ms - +1.32ms)
    this-change vs tip-of-tree

update

  • this-change: 418.66ms - 424.97ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -2% - +9% (-0.57ms - +2.76ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -2% - +5% (-1.04ms - +3.58ms)
    this-change vs tip-of-tree
  • this-change, tip-of-tree, previous-release: unsure 🔍 -1% - +2% (-3.29ms - +8.21ms)
    this-change vs tip-of-tree

update-reflect

  • this-change: 408.81ms - 413.78ms
  • this-change, tip-of-tree, previous-release: unsure 🔍 -2% - +1% (-7.56ms - +2.97ms)
    this-change vs tip-of-tree

Results

this-change

render

VersionAvg timevs
34.12ms - 35.90ms-

update

VersionAvg timevs
418.66ms - 424.97ms-

update-reflect

VersionAvg timevs
408.81ms - 413.78ms-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
15.57ms - 16.94ms-unsure 🔍
-7% - +5%
-1.14ms - +0.83ms
unsure 🔍
-6% - +6%
-0.90ms - +0.94ms
tip-of-tree
tip-of-tree
15.70ms - 17.12msunsure 🔍
-5% - +7%
-0.83ms - +1.14ms
-unsure 🔍
-5% - +7%
-0.76ms - +1.12ms
previous-release
previous-release
15.62ms - 16.85msunsure 🔍
-6% - +6%
-0.94ms - +0.90ms
unsure 🔍
-7% - +5%
-1.12ms - +0.76ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
30.82ms - 33.62ms-unsure 🔍
-2% - +9%
-0.57ms - +2.76ms
unsure 🔍
-2% - +8%
-0.70ms - +2.47ms
tip-of-tree
tip-of-tree
30.22ms - 32.03msunsure 🔍
-8% - +2%
-2.76ms - +0.57ms
-unsure 🔍
-4% - +3%
-1.39ms - +0.96ms
previous-release
previous-release
30.59ms - 32.08msunsure 🔍
-8% - +2%
-2.47ms - +0.70ms
unsure 🔍
-3% - +4%
-0.96ms - +1.39ms
-

nop-update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
9.80ms - 10.84ms-unsure 🔍
-7% - +6%
-0.73ms - +0.67ms
unsure 🔍
-10% - +4%
-1.09ms - +0.40ms
tip-of-tree
tip-of-tree
9.88ms - 10.82msunsure 🔍
-7% - +7%
-0.67ms - +0.73ms
-unsure 🔍
-10% - +4%
-1.03ms - +0.39ms
previous-release
previous-release
10.14ms - 11.20msunsure 🔍
-4% - +11%
-0.40ms - +1.09ms
unsure 🔍
-4% - +10%
-0.39ms - +1.03ms
-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
30.94ms - 32.00ms-unsure 🔍
-2% - +3%
-0.53ms - +0.98ms
unsure 🔍
-4% - +1%
-1.22ms - +0.38ms
tip-of-tree
tip-of-tree
30.71ms - 31.78msunsure 🔍
-3% - +2%
-0.98ms - +0.53ms
-unsure 🔍
-5% - +0%
-1.45ms - +0.16ms
previous-release
previous-release
31.29ms - 32.49msunsure 🔍
-1% - +4%
-0.38ms - +1.22ms
unsure 🔍
-1% - +5%
-0.16ms - +1.45ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
69.08ms - 72.43ms-unsure 🔍
-2% - +5%
-1.04ms - +3.58ms
unsure 🔍
-0% - +6%
-0.28ms - +3.96ms
tip-of-tree
tip-of-tree
67.90ms - 71.07msunsure 🔍
-5% - +1%
-3.58ms - +1.04ms
-unsure 🔍
-2% - +4%
-1.48ms - +2.62ms
previous-release
previous-release
67.61ms - 70.21msunsure 🔍
-6% - +0%
-3.96ms - +0.28ms
unsure 🔍
-4% - +2%
-2.62ms - +1.48ms
-
this-change, tip-of-tree, previous-release

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
84.80ms - 89.87ms-unsure 🔍
-4% - +1%
-3.85ms - +1.32ms
unsure 🔍
-5% - +1%
-4.13ms - +1.23ms
tip-of-tree
tip-of-tree
88.08ms - 89.13msunsure 🔍
-2% - +4%
-1.32ms - +3.85ms
-unsure 🔍
-1% - +1%
-1.20ms - +0.84ms
previous-release
previous-release
87.91ms - 89.66msunsure 🔍
-1% - +5%
-1.23ms - +4.13ms
unsure 🔍
-1% - +1%
-0.84ms - +1.20ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
423.06ms - 430.44ms-unsure 🔍
-1% - +2%
-3.29ms - +8.21ms
unsure 🔍
-1% - +2%
-5.13ms - +6.99ms
tip-of-tree
tip-of-tree
419.88ms - 428.70msunsure 🔍
-2% - +1%
-8.21ms - +3.29ms
-unsure 🔍
-2% - +1%
-8.06ms - +4.99ms
previous-release
previous-release
421.01ms - 430.63msunsure 🔍
-2% - +1%
-6.99ms - +5.13ms
unsure 🔍
-1% - +2%
-4.99ms - +8.06ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
426.52ms - 433.34ms-unsure 🔍
-2% - +1%
-7.56ms - +2.97ms
unsure 🔍
-1% - +1%
-6.22ms - +3.92ms
tip-of-tree
tip-of-tree
428.22ms - 436.24msunsure 🔍
-1% - +2%
-2.97ms - +7.56ms
-unsure 🔍
-1% - +2%
-4.34ms - +6.64ms
previous-release
previous-release
427.33ms - 434.82msunsure 🔍
-1% - +1%
-3.92ms - +6.22ms
unsure 🔍
-2% - +1%
-6.64ms - +4.34ms
-

tachometer-reporter-action v2 for Benchmarks

@github-actions

Copy link
Copy Markdown
Contributor

The size of lit-html.js and lit-core.min.js are as expected.

@kyubisation
kyubisation force-pushed the ssr-renderer-configuration branch from 454ac66 to 452cb0e Compare April 26, 2026 20:15
@kyubisation

Copy link
Copy Markdown
Contributor Author

Squashed and rebased in order to avoid the CLA failure

@kyubisation
kyubisation requested a review from justinfagnani May 7, 2026 16:58

@justinfagnani justinfagnani left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks!

@justinfagnani

Copy link
Copy Markdown
Collaborator

We should add lit.dev docs for this

@kyubisation
kyubisation merged commit 1e85a64 into main May 7, 2026
11 checks passed
@kyubisation
kyubisation deleted the ssr-renderer-configuration branch May 7, 2026 17:38
kyubisation added a commit to kyubisation/lit that referenced this pull request May 7, 2026
@lit-robot lit-robot mentioned this pull request May 14, 2026
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.

More control over connectedCallback when server-side Rendering

3 participants