@cqa-lib/cqa-ui 1.1.499 → 1.1.500

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1050,6 +1050,7 @@ class DynamicCellContainerDirective {
1050
1050
  this.viewContainerRef = viewContainerRef;
1051
1051
  this.cdr = cdr;
1052
1052
  this.initialized = false;
1053
+ this.isApplyingInputChanges = false;
1053
1054
  }
1054
1055
  ngOnInit() {
1055
1056
  if (this.componentConfig && !this.initialized) {
@@ -1061,16 +1062,25 @@ class DynamicCellContainerDirective {
1061
1062
  if (this.componentRef &&
1062
1063
  this.componentConfig &&
1063
1064
  (changes['componentConfig'] || changes['row'] || changes['column'] || changes['rowIndex'] || changes['colId'])) {
1064
- // Refresh component inputs when config or row context changes.
1065
- const inputs = this.getComponentInputs(this.componentConfig);
1066
- Object.keys(inputs).forEach(inputKey => {
1067
- if (this.componentRef?.instance && inputKey in this.componentRef.instance) {
1068
- this.componentRef.instance[inputKey] = inputs[inputKey];
1069
- }
1070
- });
1071
- // Use detectChanges to ensure styles are updated immediately
1072
- this.componentRef.changeDetectorRef.detectChanges();
1073
- this.cdr.detectChanges();
1065
+ if (this.isApplyingInputChanges) {
1066
+ return;
1067
+ }
1068
+ this.isApplyingInputChanges = true;
1069
+ try {
1070
+ // Refresh component inputs when config or row context changes.
1071
+ const inputs = this.getComponentInputs(this.componentConfig);
1072
+ Object.keys(inputs).forEach(inputKey => {
1073
+ if (this.componentRef?.instance && inputKey in this.componentRef.instance) {
1074
+ this.componentRef.instance[inputKey] = inputs[inputKey];
1075
+ }
1076
+ });
1077
+ // Avoid synchronous detectChanges inside ngOnChanges to prevent re-entrant CD loops.
1078
+ this.componentRef.changeDetectorRef.markForCheck();
1079
+ this.cdr.markForCheck();
1080
+ }
1081
+ finally {
1082
+ this.isApplyingInputChanges = false;
1083
+ }
1074
1084
  }
1075
1085
  else if (changes['componentConfig'] && this.componentConfig && !this.initialized) {
1076
1086
  // Create component if it wasn't created yet
@@ -1113,9 +1123,9 @@ class DynamicCellContainerDirective {
1113
1123
  }
1114
1124
  }
1115
1125
  });
1116
- // Mark for change detection - use detectChanges to ensure styles are applied
1117
- this.componentRef.changeDetectorRef.detectChanges();
1118
- this.cdr.detectChanges();
1126
+ // Schedule checks without forcing nested synchronous cycles.
1127
+ this.componentRef.changeDetectorRef.markForCheck();
1128
+ this.cdr.markForCheck();
1119
1129
  }
1120
1130
  catch (err) {
1121
1131
  console.error('Failed to create component in table cell:', err);