@steroidsjs/core 3.0.85 → 3.0.87

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/actions/list.js CHANGED
@@ -200,69 +200,67 @@ var listFetch = function (listId, query) {
200
200
  type: exports.LIST_BEFORE_FETCH
201
201
  });
202
202
  }
203
- toDispatch.push([
204
- Promise.resolve(onFetch(list, formValues, components, options))
205
- .then(function (data) {
206
- var _a;
207
- // Skip on empty
208
- if (!data) {
209
- return [];
210
- }
211
- // Check list is not destroy
212
- if (!getState().list.lists[listId]) {
213
- return [];
214
- }
215
- if ((0, isArray_1["default"])(data)) {
216
- data = {
217
- items: data,
218
- total: data.length,
219
- meta: null
220
- };
221
- }
222
- var items = data.items || [];
223
- var total = data.total || items.length || null;
224
- var page = formValues[list.pageAttribute];
225
- var pageSize = formValues[list.pageSizeAttribute];
226
- var totalPages = Math.ceil(((list === null || list === void 0 ? void 0 : list.total) || 0) / (pageSize || 1));
227
- var hasNextPage = (_a = data === null || data === void 0 ? void 0 : data.hasNextPage) !== null && _a !== void 0 ? _a : (page !== totalPages || null);
228
- return [
229
- (0, form_2.formSetErrors)(list.formId, data.errors || null),
230
- {
231
- items: items,
232
- total: total,
233
- hasNextPage: hasNextPage,
234
- meta: data.meta || null,
235
- page: page,
236
- pageSize: pageSize,
237
- listId: listId,
238
- defaultPageValue: list.defaultPageValue,
239
- type: exports.LIST_AFTER_FETCH
240
- },
241
- ];
242
- })["catch"](function (error) {
243
- // Если это отмена — просто игнорируем ошибку
244
- if (axios_1["default"].isCancel && axios_1["default"].isCancel(error)) {
245
- return [];
246
- }
247
- // Handle cancellation quietly
248
- // axios v0.x: axios.isCancel(error)
249
- var isAxiosCancel = typeof axios_1["default"].isCancel === 'function' && axios_1["default"].isCancel(error);
250
- if (isAxiosCancel) {
251
- // игнорируем, это отмена запроса
252
- return [];
253
- }
254
- // прочие ошибки — можно пробросить или обработать
255
- if (typeof list.onError === 'function') {
256
- list.onError(error);
257
- }
203
+ toDispatch.push(Promise.resolve(onFetch(list, formValues, components, options))
204
+ .then(function (data) {
205
+ var _a;
206
+ // Skip on empty
207
+ if (!data) {
258
208
  return [];
259
- })["finally"](function () {
260
- // убрать сохранённый источник если он тот же
261
- if (components.http._promises[listId] === source) {
262
- delete components.http._promises[listId];
263
- }
264
- }),
265
- ]);
209
+ }
210
+ // Check list is not destroy
211
+ if (!getState().list.lists[listId]) {
212
+ return [];
213
+ }
214
+ if ((0, isArray_1["default"])(data)) {
215
+ data = {
216
+ items: data,
217
+ total: data.length,
218
+ meta: null
219
+ };
220
+ }
221
+ var items = data.items || [];
222
+ var total = data.total || items.length || null;
223
+ var page = formValues[list.pageAttribute];
224
+ var pageSize = formValues[list.pageSizeAttribute];
225
+ var totalPages = Math.ceil(((list === null || list === void 0 ? void 0 : list.total) || 0) / (pageSize || 1));
226
+ var hasNextPage = (_a = data === null || data === void 0 ? void 0 : data.hasNextPage) !== null && _a !== void 0 ? _a : (page !== totalPages || null);
227
+ return [
228
+ (0, form_2.formSetErrors)(list.formId, data.errors || null),
229
+ {
230
+ items: items,
231
+ total: total,
232
+ hasNextPage: hasNextPage,
233
+ meta: data.meta || null,
234
+ page: page,
235
+ pageSize: pageSize,
236
+ listId: listId,
237
+ defaultPageValue: list.defaultPageValue,
238
+ type: exports.LIST_AFTER_FETCH
239
+ },
240
+ ];
241
+ })["catch"](function (error) {
242
+ // Если это отмена — просто игнорируем ошибку
243
+ if (axios_1["default"].isCancel && axios_1["default"].isCancel(error)) {
244
+ return [];
245
+ }
246
+ // Handle cancellation quietly
247
+ // axios v0.x: axios.isCancel(error)
248
+ var isAxiosCancel = typeof axios_1["default"].isCancel === 'function' && axios_1["default"].isCancel(error);
249
+ if (isAxiosCancel) {
250
+ // игнорируем, это отмена запроса
251
+ return [];
252
+ }
253
+ // прочие ошибки — можно пробросить или обработать
254
+ if (typeof list.onError === 'function') {
255
+ list.onError(error);
256
+ }
257
+ return [];
258
+ })["finally"](function () {
259
+ // убрать сохранённый источник если он тот же
260
+ if (components.http._promises[listId] === source) {
261
+ delete components.http._promises[listId];
262
+ }
263
+ }));
266
264
  return dispatch(toDispatch);
267
265
  };
268
266
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "3.0.85",
3
+ "version": "3.0.87",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {
@@ -218,12 +218,12 @@ function Form(props) {
218
218
  });
219
219
  // Clean
220
220
  cleanedValues = (0, form_1.cleanEmptyObject)(cleanedValues);
221
- // Event onBeforeSubmit
222
- if (props.onBeforeSubmit && props.onBeforeSubmit.call(null, cleanedValues) === false) {
221
+ if (props.validator && props.validator.call(null, cleanedValues) === false) {
223
222
  dispatch((0, form_2.formSetSubmitting)(props.formId, false));
224
223
  return [2 /*return*/, null];
225
224
  }
226
- if (props.validator && props.validator.call(null, cleanedValues) === false) {
225
+ // Event onBeforeSubmit
226
+ if (props.onBeforeSubmit && props.onBeforeSubmit.call(null, cleanedValues) === false) {
227
227
  dispatch((0, form_2.formSetSubmitting)(props.formId, false));
228
228
  return [2 /*return*/, null];
229
229
  }