tuain-ng-forms-lib 17.2.21 → 17.2.23

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.
@@ -3175,6 +3175,7 @@ class BasicFormComponent extends FormStructureAndData {
3175
3175
  _tableServerError = [];
3176
3176
  // Acciones en curso dentro del formulario
3177
3177
  _actionsInProgress = {};
3178
+ _serverActionsInProgress = {};
3178
3179
  // Datos complementarios del formulario
3179
3180
  inputDataFields = {};
3180
3181
  extraData = {};
@@ -3682,14 +3683,20 @@ class BasicFormComponent extends FormStructureAndData {
3682
3683
  async startServerAction(actionInput) {
3683
3684
  const action = (typeof actionInput === 'string')
3684
3685
  ? this.getAction(actionInput) : actionInput;
3685
- if (!action) {
3686
+ const { actionCode: code, backend } = action ?? {};
3687
+ if (!action || !code || !backend) {
3686
3688
  return;
3687
3689
  }
3688
3690
  let serverError = false;
3689
3691
  let actionResult = null;
3690
- if (action.backend) {
3691
- actionResult = await this.requestFormAction(action.actionCode);
3692
+ if (this._serverActionsInProgress[code]) {
3693
+ const { sent } = this._serverActionsInProgress[code];
3694
+ console.log(`Reingreso server en acción ${code} con ejecución previa ${sent}`);
3695
+ return;
3692
3696
  }
3697
+ this._serverActionsInProgress[code] = { sent: new Date() };
3698
+ // Se inicia la parte server de la acción
3699
+ actionResult = await this.requestFormAction(action.actionCode);
3693
3700
  await this.finishAction(action, actionResult, serverError);
3694
3701
  serverError = !!this.errorOccured();
3695
3702
  if (!serverError) {
@@ -3701,6 +3708,8 @@ class BasicFormComponent extends FormStructureAndData {
3701
3708
  callback(action);
3702
3709
  }
3703
3710
  }
3711
+ this._serverActionsInProgress[code] = null;
3712
+ delete this._serverActionsInProgress[code];
3704
3713
  action.stop();
3705
3714
  }
3706
3715
  async finishAction(action, actionResult, serverError = false) {