lion icon indicating copy to clipboard operation
lion copied to clipboard

fix(overlays): don't call _setupOverlayCtrl() in OverlayMixin if the component is not connected

Open denilsonsa opened this issue 10 months ago • 3 comments

In our application, there is a very complicated logic that creates a bunch of form fields based on some data. It's very complicated, we hate that logic; but it exists, it works, and it is being used in production.

Somewhere in that logic, under a very specific case, a datepicker form field is created, connected, and then immediately disconnected. Don't ask me why, I said it is complicated.

This commit fixes a bug in OverlayMixin. The connectedCallback calls _setupOverlayCtrl() asynchronously, after a Promise.then(). Thus, by the time this setup function is called, the component has already been disconnected (and disconnectedCallback() has already been called).

The fix is simple: don't try to setup the overlay if the component is no longer connected.

denilsonsa avatar Jun 13 '25 15:06 denilsonsa

⚠️ No Changeset found

Latest commit: 80f6b1c9b3c6cbfbc544677e5bb98021794eaf41

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Jun 13 '25 15:06 changeset-bot[bot]

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jun 13 '25 15:06 CLAassistant

Added a second one-line commit that fixes a similar issue in FocusMixin.

denilsonsa avatar Jun 13 '25 16:06 denilsonsa