native-document 1.0.177 → 1.0.179

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": "native-document",
3
- "version": "1.0.177",
3
+ "version": "1.0.179",
4
4
  "description": "A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features",
5
5
  "author": "AfroCodeur <https://github.com/afrocodeur>",
6
6
  "license": "MIT",
@@ -407,11 +407,12 @@ FormControl.prototype.$handleSubmit = async function(event) {
407
407
  return result;
408
408
 
409
409
  } catch(error) {
410
- this.$dispatchServerErrors(error);
411
- this.emit('error', error, this);
412
- if(!this.hasListeners('error')) {
410
+ const errorsMapper = this.$description.errorsMapper || FormControl.defaultErrorsMapper;
411
+ if(!errorsMapper && !this.hasListeners('error')) {
413
412
  throw error;
414
413
  }
414
+ this.$dispatchServerErrors(error);
415
+ this.emit('error', error, this);
415
416
  } finally {
416
417
  this.$description.submitting.set(false);
417
418
  this.emit('afterSubmit', this);
@@ -87,7 +87,7 @@ ObservableResource.prototype.$runWithAbortController = function(isRefetch = fals
87
87
  const depValues = this.$dependencies.map(dep => dep.val());
88
88
  const args = [...depValues, signal];
89
89
 
90
- Promise.resolve(this.$fn(...args))
90
+ return Promise.resolve(this.$fn(...args))
91
91
  .then(result => {
92
92
  if (signal.aborted) {
93
93
  return;
@@ -121,7 +121,7 @@ ObservableResource.prototype.$runWithoutAbortController = function(isRefetch = f
121
121
 
122
122
  const args = this.$dependencies.map(dep => dep.val());
123
123
 
124
- Promise.resolve(this.$fn(...args))
124
+ return Promise.resolve(this.$fn(...args))
125
125
  .then(result => {
126
126
  this.$applyResult(result);
127
127
  this.error.set(null);
@@ -203,8 +203,7 @@ ObservableResource.prototype.into = function($observable) {
203
203
  * @returns {this}
204
204
  */
205
205
  ObservableResource.prototype.fetch = function() {
206
- this.$run(false);
207
- return this;
206
+ return this.$run(false);
208
207
  };
209
208
 
210
209
  /**
@@ -214,8 +213,7 @@ ObservableResource.prototype.fetch = function() {
214
213
  * @returns {this}
215
214
  */
216
215
  ObservableResource.prototype.refetch = function() {
217
- this.$run(true);
218
- return this;
216
+ return this.$run(true);
219
217
  };
220
218
 
221
219
  /**