@colisweb/rescript-toolkit 5.49.0 → 5.49.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 +1 -1
- package/src/form/Reform.res +2 -3
package/package.json
CHANGED
package/src/form/Reform.res
CHANGED
|
@@ -189,7 +189,7 @@ module Make = (Config: Config) => {
|
|
|
189
189
|
let use = (
|
|
190
190
|
~initialState,
|
|
191
191
|
~schema=[]: Validation.schema,
|
|
192
|
-
~beforeSubmit:
|
|
192
|
+
~beforeSubmit: state => bool=_ => false,
|
|
193
193
|
~onSubmit,
|
|
194
194
|
~onSubmitFail=ignore,
|
|
195
195
|
~i18n: ReSchemaI18n.t=ReSchemaI18n.default,
|
|
@@ -200,8 +200,7 @@ module Make = (Config: Config) => {
|
|
|
200
200
|
(state, action) => {
|
|
201
201
|
switch action {
|
|
202
202
|
| Submit =>
|
|
203
|
-
state.formState == Submitting ||
|
|
204
|
-
beforeSubmit->Option.mapWithDefault(false, fn => fn(state))
|
|
203
|
+
state.formState == Submitting || beforeSubmit(state)
|
|
205
204
|
? NoUpdate
|
|
206
205
|
: UpdateWithSideEffects(
|
|
207
206
|
{...state, formState: Submitting},
|