In some environments, the lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE flag is lazily set to true, after the engine has initialized but before a component has rendered. This worked okay in LWC v6 through LWC v7.0.0, but broke in LWC v7.0.1 due to #4316, which caused all DOM monkey-patching to only occur at initialization time.
So lazily-setting the flag effectively puts you in a broken state, where the component is trying to run in synthetic lifecycle mode, but connectedCallback/disconnectedCallback never fires because the monkey-patching is never put in place.
This PR restores the previous behavior, where the monkey-patching can occur dynamically at the time the component is rendered.
Does this pull request introduce a breaking change?
😮💨 No, it does not introduce a breaking change.
Does this pull request introduce an observable change?
🔬 Yes, it does include an observable change.
Yeah but it's observable in a way that restores the previous (250-like) behavior.
Details
In some environments, the
lwcRuntimeFlags.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE
flag is lazily set totrue
, after the engine has initialized but before a component has rendered. This worked okay in LWC v6 through LWC v7.0.0, but broke in LWC v7.0.1 due to #4316, which caused all DOM monkey-patching to only occur at initialization time.So lazily-setting the flag effectively puts you in a broken state, where the component is trying to run in synthetic lifecycle mode, but
connectedCallback
/disconnectedCallback
never fires because the monkey-patching is never put in place.This PR restores the previous behavior, where the monkey-patching can occur dynamically at the time the component is rendered.
Does this pull request introduce a breaking change?
Does this pull request introduce an observable change?
Yeah but it's observable in a way that restores the previous (250-like) behavior.
GUS work item
W-16153421