diff --git a/src/Umbraco.Web.UI.Client/src/installer/consent/installer-consent.element.ts b/src/Umbraco.Web.UI.Client/src/installer/consent/installer-consent.element.ts index 18f68ee80e..8b859d2294 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/consent/installer-consent.element.ts +++ b/src/Umbraco.Web.UI.Client/src/installer/consent/installer-consent.element.ts @@ -54,31 +54,37 @@ export class UmbInstallerConsentElement extends UmbContextConsumerMixin(LitEleme @state() private _installerContext?: UmbInstallerContext; - private storeDataSubscription?: Subscription; - private storeSettingsSubscription?: Subscription; + private _installerDataSubscription?: Subscription; + private _installerSettingsSubscription?: Subscription; constructor() { super(); this.consumeContext('umbInstallerContext', (installerContext: UmbInstallerContext) => { this._installerContext = installerContext; + this._observeInstallerSettings(); + this._observeInstallerData(); + }); + } - this.storeSettingsSubscription?.unsubscribe(); - this.storeSettingsSubscription = installerContext.settings.subscribe((settings) => { - this._telemetryLevels = settings.user.consentLevels; - }); + private _observeInstallerSettings() { + this._installerSettingsSubscription?.unsubscribe(); + this._installerSettingsSubscription = this._installerContext?.settings.subscribe((settings) => { + this._telemetryLevels = settings.user.consentLevels; + }); + } - this.storeDataSubscription?.unsubscribe(); - this.storeDataSubscription = installerContext.data.subscribe((data) => { - this._telemetryFormData = data.telemetryLevel; - }); + private _observeInstallerData() { + this._installerDataSubscription?.unsubscribe(); + this._installerDataSubscription = this._installerContext?.data.subscribe((data) => { + this._telemetryFormData = data.telemetryLevel; }); } disconnectedCallback(): void { super.disconnectedCallback(); - this.storeSettingsSubscription?.unsubscribe(); - this.storeDataSubscription?.unsubscribe(); + this._installerSettingsSubscription?.unsubscribe(); + this._installerDataSubscription?.unsubscribe(); } private _handleChange(e: InputEvent) {