salesforce/lwc

`renderedCallback` documentation, spec, and consistency

nolanlawson opened this issue · 0 comments

We've seen a few inconsistencies with how renderedCallback is called:

We should probably have better documentation and specs for how renderedCallback works, perhaps similar to Lit's docs on the subject. We could also do a reform of renderedCallback to ensure that it works consistently per the spec. It's a good time to do this, now that native lifecycle has landed in LWC v6, so connectedCallback and disconnectedCallback are both correctly working per the DOM spec.

Other areas to consider in the process:

  • @wire – lots of people take data from @wire, update state, and then put if checks in renderedCallback that further sets state (despite this being an anti-pattern)
  • list rendering – can you depend on renderedCallback for all list items when the order changes? (answer: no)

Existing SFDC docs on renderedCallback