@gravitee/ui-particles-angular 17.7.1 → 17.7.2-fix-apim-12804-endpoint-group-headers-sync-f171682

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.
@@ -3331,6 +3331,8 @@ class GioFormJsonSchemaComponent {
3331
3331
  this.touched = false;
3332
3332
  this.isValid$ = new ReplaySubject(1); // Wait JsonSchema to be loaded to check if it's valid
3333
3333
  this.stateChanges$ = new Subject();
3334
+ this.isWritingValue = false;
3335
+ this.isStable = false;
3334
3336
  if (ngControl) {
3335
3337
  // Setting the value accessor directly (instead of using
3336
3338
  // the providers `NG_VALUE_ACCESSOR`) to avoid running into a circular import.
@@ -3377,9 +3379,9 @@ class GioFormJsonSchemaComponent {
3377
3379
  // Sync control value with default value (without emit event) as long as the component is not ready
3378
3380
  // When formly is initialised, it emits several values as it builds up step by step.
3379
3381
  this.formGroup.valueChanges
3380
- .pipe(distinctUntilChanged(isEqual), tap(value => {
3382
+ .pipe(distinctUntilChanged(isEqual), filter(() => this.isReady && !this.isWritingValue && this.isStable), tap(value => {
3381
3383
  this.ngControl?.control?.reset(value, { emitEvent: false });
3382
- }), takeUntil(this.ready), takeUntil(this.unsubscribe$))
3384
+ }), takeUntil(this.unsubscribe$))
3383
3385
  .subscribe();
3384
3386
  // Avoid ExpressionChangedAfterItHasBeenCheckedError on project
3385
3387
  this.changeDetectorRef.markForCheck();
@@ -3437,7 +3439,14 @@ class GioFormJsonSchemaComponent {
3437
3439
  }
3438
3440
  // From ControlValueAccessor
3439
3441
  writeValue(value) {
3442
+ this.isWritingValue = true;
3443
+ this.isStable = false;
3440
3444
  this.model = cloneDeep(value) ?? {};
3445
+ setTimeout(() => {
3446
+ this.isWritingValue = false;
3447
+ this.isStable = true;
3448
+ this.changeDetectorRef.markForCheck();
3449
+ }, 0);
3441
3450
  }
3442
3451
  // From ControlValueAccessor
3443
3452
  registerOnChange(fn) {