@alfresco/adf-process-services-cloud 9.2.0-33428582503 → 9.2.0-33655778504

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.
@@ -8674,6 +8674,7 @@ class FormCloudComponent extends FormBaseComponent {
8674
8674
  }
8675
8675
  refreshFormData(previousData = []) {
8676
8676
  const snapshot = this.snapshotRuntimeState();
8677
+ this.mergeProcessVariables(this.data ?? []);
8677
8678
  this.form = this.parseForm(this.formCloudRepresentationJSON);
8678
8679
  if (!this.form) {
8679
8680
  return;
@@ -8681,12 +8682,31 @@ class FormCloudComponent extends FormBaseComponent {
8681
8682
  const changedFieldIds = this.getChangedFieldIds(previousData, this.data ?? []);
8682
8683
  this.restoreRuntimeState(this.form, snapshot, changedFieldIds);
8683
8684
  this.setCheckParentVisibilityForValidationOnFields();
8684
- this.visibilityService.refreshVisibility(this.form);
8685
+ this.visibilityService.refreshVisibility(this.form, this.data);
8685
8686
  this.form.validateForm();
8686
8687
  this.onFormLoaded(this.form);
8687
8688
  this.formService.formRulesEvent.next(new FormRulesEvent('dataRefreshed', new FormEvent(this.form)));
8688
8689
  this.onFormDataRefreshed(this.form);
8689
8690
  }
8691
+ /**
8692
+ * Keeps the process variables on the stored representation up to date with the latest data, so that a
8693
+ * variable omitted by a later partial refresh still resolves to the most recent value received.
8694
+ *
8695
+ * @param updates Variables received on the latest data refresh
8696
+ */
8697
+ mergeProcessVariables(updates) {
8698
+ if (!this.formCloudRepresentationJSON) {
8699
+ return;
8700
+ }
8701
+ const existing = this.formCloudRepresentationJSON.processVariables ?? [];
8702
+ const byName = new Map();
8703
+ for (const variable of [...existing, ...updates]) {
8704
+ if (variable?.name) {
8705
+ byName.set(variable.name, variable);
8706
+ }
8707
+ }
8708
+ this.formCloudRepresentationJSON.processVariables = Array.from(byName.values());
8709
+ }
8690
8710
  snapshotRuntimeState() {
8691
8711
  const snapshot = new Map();
8692
8712
  if (!this.form) {