salesforce / lwc

⚡️ LWC - A Blazing Fast, Enterprise-Grade Web Components Foundation
https://lwc.dev
Other
1.65k stars 394 forks source link

[SSR] Remove hydration-related `data-lwc-*` attributes once hydration is complete #4879

Open ekashida opened 2 weeks ago

ekashida commented 2 weeks ago

We should remove the hydration-related data-lwc-* attributes once they've served their purpose to prevent users from taking a dependency on them.

nolanlawson commented 2 weeks ago

Specific steps: in hydration.ts, we look at a couple of special data-lwc-* attributes which instruct hydration to do certain things:

These attributes should be removed from the element after they are read to avoid component authors taking a dependency on them (e.g. for styling with CSS selectors).