lwc icon indicating copy to clipboard operation
lwc copied to clipboard

Use native `connectedCallback`/`disconnectedCallback` lifecycle hooks

Open nolanlawson opened this issue 3 years ago • 2 comments

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.

nolanlawson avatar Nov 23 '22 21:11 nolanlawson

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

git2gus[bot] avatar Nov 23 '22 21:11 git2gus[bot]

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.

nolanlawson avatar Jun 18 '24 18:06 nolanlawson