@inseefr/lunatic 3.0.0-rc.10 → 3.0.0-rc.11
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.
|
@@ -96,26 +96,25 @@ function useSuggesters(_ref) {
|
|
|
96
96
|
if (typeof getReferentiel === 'function' && Array.isArray(suggesters) && auto) {
|
|
97
97
|
var suggesterWorkers = suggesters.map( /*#__PURE__*/function () {
|
|
98
98
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(store) {
|
|
99
|
-
var name,
|
|
99
|
+
var name, isClean, data, _createAppendTask, _createAppendTask2, append, abort, result;
|
|
100
100
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
101
101
|
while (1) switch (_context.prev = _context.next) {
|
|
102
102
|
case 0:
|
|
103
103
|
name = store.name;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
_context.next = 4;
|
|
104
|
+
if (status.current) {
|
|
105
|
+
_context.next = 3;
|
|
107
106
|
break;
|
|
108
107
|
}
|
|
109
108
|
return _context.abrupt("return");
|
|
110
|
-
case
|
|
111
|
-
_context.prev =
|
|
112
|
-
if (!(current[name] === SuggesterStatus.idle)) {
|
|
113
|
-
_context.next =
|
|
109
|
+
case 3:
|
|
110
|
+
_context.prev = 3;
|
|
111
|
+
if (!(status.current[name] === SuggesterStatus.idle)) {
|
|
112
|
+
_context.next = 9;
|
|
114
113
|
break;
|
|
115
114
|
}
|
|
116
|
-
_context.next =
|
|
115
|
+
_context.next = 7;
|
|
117
116
|
return (0, _initStore.initStore)(store);
|
|
118
|
-
case
|
|
117
|
+
case 7:
|
|
119
118
|
isClean = _context.sent;
|
|
120
119
|
if (!isClean) {
|
|
121
120
|
setStatus(status, name, SuggesterStatus.error);
|
|
@@ -124,20 +123,20 @@ function useSuggesters(_ref) {
|
|
|
124
123
|
setStatus(status, name, SuggesterStatus.pending);
|
|
125
124
|
setTimestamp(Date.now());
|
|
126
125
|
}
|
|
127
|
-
case
|
|
128
|
-
if (!(current[name] === SuggesterStatus.pending)) {
|
|
129
|
-
_context.next =
|
|
126
|
+
case 9:
|
|
127
|
+
if (!(status.current[name] === SuggesterStatus.pending)) {
|
|
128
|
+
_context.next = 19;
|
|
130
129
|
break;
|
|
131
130
|
}
|
|
132
|
-
_context.next =
|
|
131
|
+
_context.next = 12;
|
|
133
132
|
return getReferentiel(name);
|
|
134
|
-
case
|
|
133
|
+
case 12:
|
|
135
134
|
data = _context.sent;
|
|
136
135
|
_createAppendTask = (0, _createAppendTask3.createAppendTask)(store, 1, nothing, workersBasePath), _createAppendTask2 = _slicedToArray(_createAppendTask, 2), append = _createAppendTask2[0], abort = _createAppendTask2[1];
|
|
137
136
|
aborts.current.push(abort);
|
|
138
|
-
_context.next =
|
|
137
|
+
_context.next = 17;
|
|
139
138
|
return append(data);
|
|
140
|
-
case
|
|
139
|
+
case 17:
|
|
141
140
|
result = _context.sent;
|
|
142
141
|
if (result) {
|
|
143
142
|
setStatus(status, name, SuggesterStatus.success);
|
|
@@ -146,20 +145,20 @@ function useSuggesters(_ref) {
|
|
|
146
145
|
setStatus(status, name, SuggesterStatus.error);
|
|
147
146
|
setTimestamp(Date.now());
|
|
148
147
|
}
|
|
149
|
-
case
|
|
150
|
-
_context.next =
|
|
148
|
+
case 19:
|
|
149
|
+
_context.next = 26;
|
|
151
150
|
break;
|
|
152
|
-
case
|
|
153
|
-
_context.prev =
|
|
154
|
-
_context.t0 = _context["catch"](
|
|
151
|
+
case 21:
|
|
152
|
+
_context.prev = 21;
|
|
153
|
+
_context.t0 = _context["catch"](3);
|
|
155
154
|
console.error(_context.t0);
|
|
156
155
|
setStatus(status, name, SuggesterStatus.error);
|
|
157
156
|
setTimestamp(Date.now());
|
|
158
|
-
case
|
|
157
|
+
case 26:
|
|
159
158
|
case "end":
|
|
160
159
|
return _context.stop();
|
|
161
160
|
}
|
|
162
|
-
}, _callee, null, [[
|
|
161
|
+
}, _callee, null, [[3, 21]]);
|
|
163
162
|
}));
|
|
164
163
|
return function (_x) {
|
|
165
164
|
return _ref3.apply(this, arguments);
|