-
Notifications
You must be signed in to change notification settings - Fork 393
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: add data-lwc-host-mutated
during SSR
#4358
Conversation
|
||
export default class Child extends LightningElement { | ||
@api foo; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removes a warning, because I wanted to test that there are no warnings.
yolo = 'woot'; | ||
|
||
connectedCallback() { | ||
this.setAttribute('data-mutatis', 'mutandis'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So intellectual!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤓
import { LightningElement } from 'lwc'; | ||
|
||
export default class Child extends LightningElement { | ||
yolo = 'woot'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So ... not.
Co-authored-by: Will Harney <62956339+wjhsf@users.noreply.github.com>
Co-authored-by: Will Harney <62956339+wjhsf@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nolan and I went over the PR 1:1 on a video call. LGTM.
Details
Detects when an SSR'd component mutates its own host element (e.g. adding/removing classes/attributes) during its
connectedCallback
, adding adata-lwc-host-mutated
attribute. This attribute is read during hydration time, and validation for the element's classes/attrs is skipped entirely, the same as if the component had explicitly setstatic validationOptOut = true
.The goal is to make it easier for component authors to ignore small hydration errors caused by mutating their hosts during
connectedCallback
.Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?
Kinda? But this is for SSR, which is not officially supported yet, and this removes restrictions rather than adding them.
GUS work item