@shopify/react-form
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -8,2 +8,9 @@ # Changelog | ||
## [0.1.1] | ||
### Fixed | ||
- now correctly depends on `fast-deep-equal` [#680](https://github.com/Shopify/quilt/pull/680) | ||
- no longer triggers set-state warnings when the component calling `useSubmit` is unmounted during submission [#680](https://github.com/Shopify/quilt/pull/680) | ||
## [0.1.0] | ||
@@ -10,0 +17,0 @@ |
@@ -5,5 +5,7 @@ "use strict"; | ||
var react_1 = require("react"); | ||
var react_hooks_1 = require("@shopify/react-hooks"); | ||
var utilities_1 = require("../utilities"); | ||
function useSubmit(onSubmit, fieldBag) { | ||
if (onSubmit === void 0) { onSubmit = noopSubmission; } | ||
var mounted = react_hooks_1.useMountedRef(); | ||
var _a = tslib_1.__read(react_1.useState(false), 2), submitting = _a[0], setSubmitting = _a[1]; | ||
@@ -24,2 +26,5 @@ var _b = tslib_1.__read(react_1.useState([]), 2), remoteErrors = _b[0], setRemoteErrors = _b[1]; | ||
result = _a.sent(); | ||
if (mounted.current === false) { | ||
return [2 /*return*/]; | ||
} | ||
setSubmitting(false); | ||
@@ -26,0 +31,0 @@ if (result.status === 'fail') { |
{ | ||
"name": "@shopify/react-form", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"license": "MIT", | ||
@@ -40,4 +40,6 @@ "description": "Manage react forms tersely and safely-typed with no magic using React hooks.", | ||
"@shopify/predicates": "^1.1.0", | ||
"@shopify/react-hooks": "^1.2.1", | ||
"fast-deep-equal": "^2.0.1", | ||
"get-value": "^3.0.1" | ||
} | ||
} |
88363
1505
5
+ Added@shopify/react-hooks@^1.2.1
+ Addedfast-deep-equal@^2.0.1
+ Added@shopify/react-hooks@1.13.1(transitive)
+ Addedfast-deep-equal@2.0.1(transitive)