From 184898c111dcb81f269fffc6b82688cc6f25aac2 Mon Sep 17 00:00:00 2001 From: Mathieu Puech Date: Mon, 22 Jun 2020 10:01:01 -0400 Subject: [PATCH] fix(select-rich): instantiation after first update --- .../src/registration/FormRegistrarPortalMixin.js | 2 +- packages/select-rich/src/LionSelectRich.js | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/form-core/src/registration/FormRegistrarPortalMixin.js b/packages/form-core/src/registration/FormRegistrarPortalMixin.js index e288897df..c5dfda081 100644 --- a/packages/form-core/src/registration/FormRegistrarPortalMixin.js +++ b/packages/form-core/src/registration/FormRegistrarPortalMixin.js @@ -32,7 +32,6 @@ export const FormRegistrarPortalMixin = dedupeMixin( if (super.connectedCallback) { super.connectedCallback(); } - this.__checkRegistrationTarget(); formRegistrarManager.add(this); if (this.__hasBeenRendered) { @@ -66,6 +65,7 @@ export const FormRegistrarPortalMixin = dedupeMixin( } firstUpdated(changedProperties) { + this.__checkRegistrationTarget(); super.firstUpdated(changedProperties); this.__resolveRegistrationReady(); this.__readyForRegistration = true; diff --git a/packages/select-rich/src/LionSelectRich.js b/packages/select-rich/src/LionSelectRich.js index b33cb1bdf..566e00fe4 100644 --- a/packages/select-rich/src/LionSelectRich.js +++ b/packages/select-rich/src/LionSelectRich.js @@ -203,17 +203,9 @@ export class LionSelectRich extends ScopedElementsMixin( this.__hasInitialSelectedFormElement = false; this.hasNoDefaultSelected = false; this._repropagationRole = 'choice-group'; // configures FormControlMixin - this.__setupEventListeners(); this.__initInteractionStates(); } - connectedCallback() { - this._listboxNode.registrationTarget = this; - if (super.connectedCallback) { - super.connectedCallback(); - } - } - disconnectedCallback() { if (super.disconnectedCallback) { super.disconnectedCallback(); @@ -233,6 +225,8 @@ export class LionSelectRich extends ScopedElementsMixin( this.__setupInvokerNode(); this.__setupListboxNode(); + this.__setupEventListeners(); + this._listboxNode.registrationTarget = this; formRegistrarManager.addEventListener('all-forms-open-for-registration', () => { // Now that we have rendered + registered our listbox, try setting the user defined modelValue again