Comparing version 0.0.8 to 0.0.9
@@ -831,3 +831,4 @@ "use strict"; | ||
(0, import_set_get3.setPath)(state.values, fieldName, value); | ||
state.dirtyFields[fieldName] = true; | ||
const defaultValue = getFieldDefaultValue(state, fieldName); | ||
state.dirtyFields[fieldName] = value !== defaultValue; | ||
}); | ||
@@ -892,11 +893,17 @@ if (get().submitSource === "dom" && controlledFieldRefs.has(fieldName) && !fieldSerializerRefs.has(fieldName)) { | ||
} | ||
set((state) => { | ||
state.submitStatus = "success"; | ||
}); | ||
mutableImplStore.onSubmitSuccess?.(response); | ||
try { | ||
await mutableImplStore.onSubmitSuccess?.(response); | ||
} finally { | ||
set((state) => { | ||
state.submitStatus = "success"; | ||
}); | ||
} | ||
} catch (err) { | ||
set((state) => { | ||
state.submitStatus = "error"; | ||
}); | ||
mutableImplStore.onSubmitFailure?.(err); | ||
try { | ||
await mutableImplStore.onSubmitFailure?.(err); | ||
} finally { | ||
set((state) => { | ||
state.submitStatus = "error"; | ||
}); | ||
} | ||
} | ||
@@ -903,0 +910,0 @@ }, |
@@ -201,4 +201,4 @@ import * as zustand_react from 'zustand/react'; | ||
onSubmit: StateSubmitHandler | DomSubmitHandler; | ||
onSubmitSuccess: (responseData: unknown) => void; | ||
onSubmitFailure: (error: unknown) => void; | ||
onSubmitSuccess: (responseData: unknown) => void | Promise<void>; | ||
onSubmitFailure: (error: unknown) => void | Promise<void>; | ||
}; | ||
@@ -242,4 +242,4 @@ type FormStoreInit = { | ||
onSubmit: StateSubmitHandler | DomSubmitHandler; | ||
onSubmitSuccess: (responseData: unknown) => void; | ||
onSubmitFailure: (error: unknown) => void; | ||
onSubmitSuccess: (responseData: unknown) => void | Promise<void>; | ||
onSubmitFailure: (error: unknown) => void | Promise<void>; | ||
formProps: StoreFormProps; | ||
@@ -246,0 +246,0 @@ flags: StoreFlags; |
@@ -764,3 +764,4 @@ var __getOwnPropNames = Object.getOwnPropertyNames; | ||
setPath2(state.values, fieldName, value); | ||
state.dirtyFields[fieldName] = true; | ||
const defaultValue = getFieldDefaultValue(state, fieldName); | ||
state.dirtyFields[fieldName] = value !== defaultValue; | ||
}); | ||
@@ -825,11 +826,17 @@ if (get().submitSource === "dom" && controlledFieldRefs.has(fieldName) && !fieldSerializerRefs.has(fieldName)) { | ||
} | ||
set((state) => { | ||
state.submitStatus = "success"; | ||
}); | ||
mutableImplStore.onSubmitSuccess?.(response); | ||
try { | ||
await mutableImplStore.onSubmitSuccess?.(response); | ||
} finally { | ||
set((state) => { | ||
state.submitStatus = "success"; | ||
}); | ||
} | ||
} catch (err) { | ||
set((state) => { | ||
state.submitStatus = "error"; | ||
}); | ||
mutableImplStore.onSubmitFailure?.(err); | ||
try { | ||
await mutableImplStore.onSubmitFailure?.(err); | ||
} finally { | ||
set((state) => { | ||
state.submitStatus = "error"; | ||
}); | ||
} | ||
} | ||
@@ -836,0 +843,0 @@ }, |
{ | ||
"name": "@rvf/core", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Easy, predictable form state management for React", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.cjs.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
13110245
122224