@processmaker/screen-builder 2.62.0 → 2.62.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/screen-builder",
3
- "version": "2.62.0",
3
+ "version": "2.62.1",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
package/src/.DS_Store CHANGED
Binary file
@@ -31,12 +31,16 @@ function countErrors(obj) {
31
31
  return errors;
32
32
  }
33
33
 
34
- const updateValidationRules = async (screen, commit) => {
35
- const rootScreen = findRootScreen(screen);
36
- if (rootScreen !== screen) {
37
- // refresh nested screen validation rules
38
- await screen.loadValidationRules();
39
- }
34
+ const updateValidationRules = async (screens, commit) => {
35
+ const rootScreen = findRootScreen(screens[0]);
36
+ const awaitLoad = [];
37
+ screens.forEach((screen) => {
38
+ if (rootScreen !== screen) {
39
+ // refresh nested screen validation rules
40
+ awaitLoad.push(screen.loadValidationRules());
41
+ }
42
+ });
43
+ await Promise.all(awaitLoad);
40
44
  try {
41
45
  await rootScreen.loadValidationRules();
42
46
  } catch (error) {
@@ -67,7 +71,15 @@ const updateValidationRules = async (screen, commit) => {
67
71
  }
68
72
  };
69
73
 
70
- const updateValidationRulesDebounced = debounce(updateValidationRules, 1000);
74
+ const updateValidationRulesDebounced = debounce(updateValidationRules, 500);
75
+
76
+ const screensToValidate = [];
77
+ const queueUpdateValidationRules = (mainScreen, commit) => {
78
+ if (!screensToValidate.includes(mainScreen)) {
79
+ screensToValidate.push(mainScreen);
80
+ }
81
+ updateValidationRulesDebounced(screensToValidate, commit);
82
+ };
71
83
 
72
84
  const globalErrorsModule = {
73
85
  namespaced,
@@ -100,14 +112,14 @@ const globalErrorsModule = {
100
112
  },
101
113
  actions: {
102
114
  validate({ commit }, mainScreen) {
103
- updateValidationRulesDebounced(mainScreen, commit);
115
+ queueUpdateValidationRules(mainScreen, commit);
104
116
  },
105
117
  async validateNow({ commit }, mainScreen) {
106
- await updateValidationRules(mainScreen, commit);
118
+ await updateValidationRules([mainScreen], commit);
107
119
  },
108
120
  close({ commit }) {
109
121
  commit("basic", { key: "valid", value: true });
110
- },
122
+ }
111
123
  }
112
124
  };
113
125