RedHat-UX / red-hat-design-system

Red Hat's Design System
https://ux.redhat.com
MIT License
94 stars 18 forks source link

[bug][docs]: `<rh-alert>` DSD & Hydration + hasSlotted #1858

Open zeroedin opened 6 days ago

zeroedin commented 6 days ago

There is an issue when <rh-alert> and most likely any element that relies on SlotController and the hasSlotted method to tell if the component if something has been slotted and then DSD'ing that element.

IIRC The server doesn't have the ability to understand if something has been slotted or not and will have to be hydrated up to that point (Maybe CLS here). However upon load on the client this hydration also doesn't seem to happening correctly currently.

We can recreate this here (although demo is currently broken in other ways too) https://ux.redhat.com/elements/alert/demo/

bennypowers commented 6 days ago

Lit SSR cannot read children. Dsd templates have to be able to stream. In eleventy we don't have that limitation, but nonetheless LitLabs ssr can't do it atm. We could investigate alternatives like https://indieweb.social/@deebloo/113113826701184888

The best we can do with the current crop of tools is set props, either as attributes, or in the node process as properties on the litelememt objects, but AFAIK eleventy-plugin-lit doesn't support that.

A has-slotted="a,b,c" attribute on the host is something we could investigate building into slotcontroller.

bennypowers commented 3 days ago

https://github.com/patternfly/patternfly-elements/pull/2845