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