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

feat: ssr-friendly slot-controller #2505

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

feat: ssr-friendly slot-controller #2505

wants to merge 7 commits into from

Conversation

bennypowers
Copy link
Member

@bennypowers bennypowers commented May 25, 2023

👉 DRAFT PR DO NOT MERGE 👈
This approach is experimental and requires discussion before pursuing. This PR is a PoC only. However there is a lot to get excited about. for example, we could load a /elements/pf-icon/pf-icon-ssr.js at ssr time which, instead of setting up a bunch of client side js to fetch and render the icon, would just dump the contents of the svg into shadow root with await readFile, at SSR time.

Read more: https://lit.dev/docs/ssr/overview/

TODO:

use export conditions instead of isServer

image
image

What I did

  1. implement lit-ssr in slot-controller via a new has-slotted host attr

Testing Instructions

  1. disable javascript and visit PR Preview Card SSR demo (webkit or chromium until firefox implements)

Notes to Reviewers

Problem: Lit-SSR can't access the children, whereas SlotController relies on knowledge about the children.
Proposal: read has-slotted="a,b,c" attr on SlotController hosts. This has limitations:

  1. content author has to add attrs
  2. we can't use hasSlotted in connectedCallback, only in render (lit may relax this limitation in the future)

@changeset-bot
Copy link

changeset-bot bot commented May 25, 2023

⚠️ No Changeset found

Latest commit: bf89edb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions bot added demo Updating demo pages functionality Functionality, typically pertaining to the JavaScript. tools Development and build tools work in progress POC / Not ready for review labels May 25, 2023
@github-actions github-actions bot added this to In progress in Workflow May 25, 2023
@github-actions github-actions bot added the AT passed Automated testing has passed label May 25, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 25, 2023

Deploy Preview for patternfly-elements ready!

Name Link
🔨 Latest commit b033028
😎 Deploy Preview https://deploy-preview-2505--patternfly-elements.netlify.app/

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions github-actions bot added the doc label May 25, 2023
@markcaron markcaron removed the doc label Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AT passed Automated testing has passed demo Updating demo pages functionality Functionality, typically pertaining to the JavaScript. tools Development and build tools work in progress POC / Not ready for review
Projects
Workflow
In progress
Development

Successfully merging this pull request may close these issues.

None yet

2 participants