@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colisweb/rescript-toolkit",
3
- "version": "5.49.0",
3
+ "version": "5.49.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -189,7 +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
+ ~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},