salesforce / lwc

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

Use native `connectedCallback`/`disconnectedCallback` lifecycle hooks #3198

Open nolanlawson opened 1 year ago

nolanlawson commented 1 year ago

We use non-standard mechanisms to trigger connectedCallback/disconnectedCallback. We should just use the native mechanism instead.

https://github.com/salesforce/lwc/blob/551f6349421f3cfaf4e8c4a8d3d393b7549bb0ab/packages/@lwc/engine-dom/src/apis/create-element.ts#L50-L72

This has implications for backwards compat, because the timing and other subtleties will be different.

Related: https://github.com/salesforce/lwc/issues/2609, https://github.com/salesforce/lwc/issues/1102, https://github.com/salesforce/lwc/pull/2709

Also related: #2986 which added a flag, without making the flag true by default.

git2gus[bot] commented 1 year ago

This issue has been linked to a new work item: W-12114614

nolanlawson commented 4 months ago

Reopening as native custom element lifecycle had to be reverted in the Salesforce Lightning Platform due to breaking changes, although it is still rolled out for pure OSS consumers.