diff --git a/packages/angular-sdk-components/src/lib/_components/template/data-reference/data-reference.component.ts b/packages/angular-sdk-components/src/lib/_components/template/data-reference/data-reference.component.ts index c6ca3804..715dc013 100644 --- a/packages/angular-sdk-components/src/lib/_components/template/data-reference/data-reference.component.ts +++ b/packages/angular-sdk-components/src/lib/_components/template/data-reference/data-reference.component.ts @@ -69,27 +69,7 @@ export class DataReferenceComponent implements OnInit, OnDestroy { this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); this.children = this.pConn$.getChildren(); this.updateSelf(); - } - - ngOnDestroy(): void { - if (this.angularPConnectData.unsubscribeFn) { - this.angularPConnectData.unsubscribeFn(); - } - } - - // Callback passed when subscribing to store change - onStateChange() { - // Should always check the bridge to see if the component should - // update itself (re-render) - const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); - - // ONLY call updateSelf when the component should update - if (bUpdateSelf) { - this.updateSelf(); - } - } - getData() { if ( this.rawViewMetadata.config?.parameters && !this.isDDSourceDeferred && @@ -130,6 +110,24 @@ export class DataReferenceComponent implements OnInit, OnDestroy { } } + ngOnDestroy(): void { + if (this.angularPConnectData.unsubscribeFn) { + this.angularPConnectData.unsubscribeFn(); + } + } + + // Callback passed when subscribing to store change + onStateChange() { + // Should always check the bridge to see if the component should + // update itself (re-render) + const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); + + // ONLY call updateSelf when the component should update + if (bUpdateSelf) { + this.updateSelf(); + } + } + updateSelf() { // Update properties based on configProps const theConfigProps = this.pConn$.getConfigProps(); @@ -188,7 +186,6 @@ export class DataReferenceComponent implements OnInit, OnDestroy { this.generateChildrenToRender(); this.displayChild = !(this.displaySingleRef || this.displayMultiRef); - this.getData(); } updatePropertiesFromProps(theConfigProps) {