@domonda/form
Advanced tools
Comparing version 2.3.5 to 2.3.6
@@ -6,2 +6,13 @@ # Change Log | ||
## [2.3.6](https://github.com/domonda/domonda-js/compare/@domonda/form@2.3.5...@domonda/form@2.3.6) (2020-10-16) | ||
### Bug Fixes | ||
* **form:** Prevent multiple parallel submissions ([#61](https://github.com/domonda/domonda-js/issues/61)) ([d5bbc79](https://github.com/domonda/domonda-js/commit/d5bbc796fffc97f5f85ed9f356645f0bdbcd0d63)) | ||
## [2.3.5](https://github.com/domonda/domonda-js/compare/@domonda/form@2.3.4...@domonda/form@2.3.5) (2020-07-01) | ||
@@ -8,0 +19,0 @@ |
@@ -93,3 +93,3 @@ /** | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { resetOnSuccessfulSubmit, resetOnFailedSubmit, onSubmit, disableOnSubmit, } = configRef.current; | ||
const { resetOnSuccessfulSubmit, resetOnFailedSubmit, onSubmit, disableOnSubmit, autoSubmit, allowSubmitWhileSubmitting, } = configRef.current; | ||
if (onSubmit) { | ||
@@ -99,2 +99,9 @@ if (event) { | ||
} | ||
if ( | ||
// allow parallel submissions when `autoSubmit` is enabled by default | ||
(allowSubmitWhileSubmitting === undefined && !autoSubmit && plumb.state.submitting) || | ||
// when explicitly set, never allow parallel submissions | ||
(allowSubmitWhileSubmitting === false && plumb.state.submitting)) { | ||
return; | ||
} | ||
plumb.next(Object.assign(Object.assign({}, plumb.state), { submitting: true, submitError: null, disabled: disableOnSubmit ? true : plumb.state.disabled }), FormTag.SUBMIT); | ||
@@ -101,0 +108,0 @@ const { fields } = plumb.state; |
@@ -29,3 +29,7 @@ /** | ||
onSubmit?: FormSubmitHandler<T>; | ||
/** Automatically submit the form when changes happen. */ | ||
/** | ||
* Automatically submit the form when changes happen. Note that | ||
* allowing multiple parallel submissions will be enabled by | ||
* default when the form is in `autoSubmit` mode. | ||
*/ | ||
autoSubmit?: boolean; | ||
@@ -51,2 +55,11 @@ /** | ||
transformer?: Transformer<T, FormTag>; | ||
/** | ||
* The form by default prevents multiple parallel submissions, submitting | ||
* is only possible if there is no submit in-flight. BEWARE: when the form is | ||
* in `autoSubmit` mode, parallel submissions will be enabled by default. | ||
* | ||
* Set this prop to `true` to allow parallel submissions *always*. Set to `false` | ||
* to prevent parallel submissions *always*. | ||
*/ | ||
allowSubmitWhileSubmitting?: boolean; | ||
} | ||
@@ -53,0 +66,0 @@ export interface FormFieldState { |
{ | ||
"name": "@domonda/form", | ||
"version": "2.3.5", | ||
"version": "2.3.6", | ||
"description": "Powerful yet simple form library built using @domonda/plumb.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28520
480