-
Notifications
You must be signed in to change notification settings - Fork 106
feat: ssr-friendly slot-controller #2505
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
Conversation
|
✅ Deploy Preview for patternfly-elements ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
|
closing in favour of #2893 |
* chore: nvm use lts * chore: bump lit-labs/ssr * chore: bump lit/context * fix: update context usage for ssr * fix: use lit-ssr html function * fix(core): rely on lit's dom-shim * chore: update and align lit version * fix(core): ssr connected callback * fix(elements): ssr connected callbacks * fix(elements): table th role from context instead of dom * feat(core): wip slots decorator * fix(core): empty array check * fix(core): remove need for static decorator for ssr slot hints * fix(core): client-side slot controller doens't use isServer * fix(core): ssr-hint-has-default-slotted attr name * test: ssr demos backported from #2505 * chore: ssr dev packages * chore: deps * docs: build elements * docs: format * chore: revert ssr we'll have to either patch or reimplement like we did in rhds * style: lint * docs: remove preloads * docs: changeset
👉 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.jsat 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 withawait readFile, at SSR time.Read more: https://lit.dev/docs/ssr/overview/
TODO:
use export conditions instead of
isServerWhat I did
has-slottedhost attrTesting Instructions
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:hasSlottedin connectedCallback, only inrender(lit may relax this limitation in the future)