@graphcommerce/react-hook-form 3.0.3 → 3.0.6
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/CHANGELOG.md +77 -130
- package/package.json +10 -8
- package/src/ComposedForm/ComposedForm.tsx +1 -1
- package/src/ComposedForm/ComposedSubmit.tsx +2 -2
- package/src/ComposedForm/index.ts +0 -4
- package/src/diff.ts +1 -1
- package/src/useFormAutoSubmit.tsx +2 -1
- package/src/useFormGqlMutation.tsx +2 -0
- package/src/useGqlDocumentHandler.tsx +5 -2
- package/src/useLazyQueryPromise.tsx +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,95 +1,87 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 3.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1369](https://github.com/graphcommerce-org/graphcommerce/pull/1369) [`ae6449502`](https://github.com/graphcommerce-org/graphcommerce/commit/ae64495024a455bbe5188588604368c1542840c9) Thanks [@paales](https://github.com/paales)! - Upgraded dependencies
|
|
8
|
+
|
|
9
|
+
## 3.0.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1312](https://github.com/ho-nl/m2-pwa/pull/1312) [`4e1fd4d9f`](https://github.com/ho-nl/m2-pwa/commit/4e1fd4d9fda2109de378be7e39382f7014a7ab54) Thanks [@paales](https://github.com/paales)! - upgraded dependencies
|
|
14
|
+
|
|
15
|
+
## 3.0.4
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#1307](https://github.com/ho-nl/m2-pwa/pull/1307) [`bd10506d3`](https://github.com/ho-nl/m2-pwa/commit/bd10506d32fdbc91d01dadc29a12ebd1e0943655) Thanks [@paales](https://github.com/paales)! - All default exports are now named exports internally and all `index.tsx` are renamed to the component name.
|
|
20
|
+
|
|
21
|
+
* [#1307](https://github.com/ho-nl/m2-pwa/pull/1307) [`27cb1f2d8`](https://github.com/ho-nl/m2-pwa/commit/27cb1f2d8dbfb8f1b301ce56fb6a2b6c1fc6a5ef) Thanks [@paales](https://github.com/paales)! - upgrade dependencies
|
|
22
|
+
|
|
3
23
|
## 3.0.3
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
6
26
|
|
|
7
|
-
- [`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96)
|
|
8
|
-
Thanks [@paales](https://github.com/paales)! - made packages public
|
|
27
|
+
- [`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96) Thanks [@paales](https://github.com/paales)! - made packages public
|
|
9
28
|
|
|
10
|
-
* [#1278](https://github.com/ho-nl/m2-pwa/pull/1278)
|
|
11
|
-
[`81ea406d5`](https://github.com/ho-nl/m2-pwa/commit/81ea406d54d6b5c662c030a7fea444abc4117a20)
|
|
12
|
-
Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Upgraded dependencies to the latest version
|
|
29
|
+
* [#1278](https://github.com/ho-nl/m2-pwa/pull/1278) [`81ea406d5`](https://github.com/ho-nl/m2-pwa/commit/81ea406d54d6b5c662c030a7fea444abc4117a20) Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Upgraded dependencies to the latest version
|
|
13
30
|
|
|
14
31
|
## 3.0.2
|
|
15
32
|
|
|
16
33
|
### Patch Changes
|
|
17
34
|
|
|
18
|
-
- [#1274](https://github.com/ho-nl/m2-pwa/pull/1274)
|
|
19
|
-
[`381e4c86a`](https://github.com/ho-nl/m2-pwa/commit/381e4c86a8321ce96e1fa5c7d3c0a0c0ff3e02c7)
|
|
20
|
-
Thanks [@paales](https://github.com/paales)! - Moved `ApolloErrorAlert`, `ApolloErrorFullPage` and
|
|
21
|
-
`ApolloErrorSnackbar` to the ecommerce-ui package.
|
|
35
|
+
- [#1274](https://github.com/ho-nl/m2-pwa/pull/1274) [`381e4c86a`](https://github.com/ho-nl/m2-pwa/commit/381e4c86a8321ce96e1fa5c7d3c0a0c0ff3e02c7) Thanks [@paales](https://github.com/paales)! - Moved `ApolloErrorAlert`, `ApolloErrorFullPage` and `ApolloErrorSnackbar` to the ecommerce-ui package.
|
|
22
36
|
|
|
23
|
-
Created `ComposedSubmitButton` and `ComposedSubmitLinkOrButton` to reduce complexity from
|
|
24
|
-
`magento-graphcms` example.
|
|
37
|
+
Created `ComposedSubmitButton` and `ComposedSubmitLinkOrButton` to reduce complexity from `magento-graphcms` example.
|
|
25
38
|
|
|
26
39
|
Removed dependency an `@graphcommerce/react-hook-form` from `magento-graphcms` example.
|
|
27
40
|
|
|
28
41
|
Added dependency `@graphcommerce/ecommerce-ui` from `magento-graphcms` example.
|
|
29
42
|
|
|
30
|
-
* [#1276](https://github.com/ho-nl/m2-pwa/pull/1276)
|
|
31
|
-
[`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2)
|
|
32
|
-
Thanks [@paales](https://github.com/paales)! - We've moved lots of internal packages from
|
|
33
|
-
`dependencies` to `peerDependencies`. The result of this is that there will be significantly less
|
|
34
|
-
duplicate packages in the node_modules folders.
|
|
43
|
+
* [#1276](https://github.com/ho-nl/m2-pwa/pull/1276) [`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2) Thanks [@paales](https://github.com/paales)! - We've moved lots of internal packages from `dependencies` to `peerDependencies`. The result of this is that there will be significantly less duplicate packages in the node_modules folders.
|
|
35
44
|
|
|
36
|
-
- [#1276](https://github.com/ho-nl/m2-pwa/pull/1276)
|
|
37
|
-
[`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d)
|
|
38
|
-
Thanks [@paales](https://github.com/paales)! - Upgraded to
|
|
39
|
-
[NextJS 12.1](https://nextjs.org/blog/next-12-1)! This is just for compatibility, but we'll be
|
|
40
|
-
implementing
|
|
41
|
-
[On-demand Incremental Static Regeneration](https://nextjs.org/blog/next-12-1#on-demand-incremental-static-regeneration-beta)
|
|
42
|
-
soon.
|
|
45
|
+
- [#1276](https://github.com/ho-nl/m2-pwa/pull/1276) [`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d) Thanks [@paales](https://github.com/paales)! - Upgraded to [NextJS 12.1](https://nextjs.org/blog/next-12-1)! This is just for compatibility, but we'll be implementing [On-demand Incremental Static Regeneration](https://nextjs.org/blog/next-12-1#on-demand-incremental-static-regeneration-beta) soon.
|
|
43
46
|
|
|
44
|
-
This will greatly reduce the requirement to rebuid stuff and we'll add a management UI on the
|
|
45
|
-
frontend to be able to revalidate pages manually.
|
|
47
|
+
This will greatly reduce the requirement to rebuid stuff and we'll add a management UI on the frontend to be able to revalidate pages manually.
|
|
46
48
|
|
|
47
49
|
## 3.0.1
|
|
48
50
|
|
|
49
51
|
### Patch Changes
|
|
50
52
|
|
|
51
|
-
- [`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514)
|
|
52
|
-
Thanks [@paales](https://github.com/paales)! - Added homepage and repository package.json files,
|
|
53
|
-
so that the packages link to back to the website and repository
|
|
53
|
+
- [`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514) Thanks [@paales](https://github.com/paales)! - Added homepage and repository package.json files, so that the packages link to back to the website and repository
|
|
54
54
|
|
|
55
55
|
## 3.0.0
|
|
56
56
|
|
|
57
57
|
### Major Changes
|
|
58
58
|
|
|
59
|
-
- [#1258](https://github.com/ho-nl/m2-pwa/pull/1258)
|
|
60
|
-
[`ad36382a4`](https://github.com/ho-nl/m2-pwa/commit/ad36382a4d55d83d9e47b7eb6a02671a2a631a05)
|
|
61
|
-
Thanks [@paales](https://github.com/paales)! - Upgraded to Material UI 5
|
|
59
|
+
- [#1258](https://github.com/ho-nl/m2-pwa/pull/1258) [`ad36382a4`](https://github.com/ho-nl/m2-pwa/commit/ad36382a4d55d83d9e47b7eb6a02671a2a631a05) Thanks [@paales](https://github.com/paales)! - Upgraded to Material UI 5
|
|
62
60
|
|
|
63
|
-
All notable changes to this project will be documented in this file. See
|
|
64
|
-
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
61
|
+
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
65
62
|
|
|
66
63
|
## [2.104.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/react-hook-form@2.104.0...@graphcommerce/react-hook-form@2.104.1) (2021-12-03)
|
|
67
64
|
|
|
68
65
|
### Bug Fixes
|
|
69
66
|
|
|
70
|
-
- make the headerHeight properly configurable
|
|
71
|
-
([c39c942](https://github.com/ho-nl/m2-pwa/commit/c39c942a62a9bb9687ea553be28e37fb49a6b065))
|
|
67
|
+
- make the headerHeight properly configurable ([c39c942](https://github.com/ho-nl/m2-pwa/commit/c39c942a62a9bb9687ea553be28e37fb49a6b065))
|
|
72
68
|
|
|
73
69
|
# [2.104.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/react-hook-form@2.103.1...@graphcommerce/react-hook-form@2.104.0) (2021-11-12)
|
|
74
70
|
|
|
75
71
|
### Features
|
|
76
72
|
|
|
77
|
-
- added tons of translations
|
|
78
|
-
([9bb0ac7](https://github.com/ho-nl/m2-pwa/commit/9bb0ac709b58df6ea6141e92e4923a5ca9ae2963))
|
|
73
|
+
- added tons of translations ([9bb0ac7](https://github.com/ho-nl/m2-pwa/commit/9bb0ac709b58df6ea6141e92e4923a5ca9ae2963))
|
|
79
74
|
|
|
80
75
|
# [2.103.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/react-hook-form@2.102.14...@graphcommerce/react-hook-form@2.103.0) (2021-11-03)
|
|
81
76
|
|
|
82
77
|
### Bug Fixes
|
|
83
78
|
|
|
84
|
-
- add x-recaptcha header to apollo link context when using mutations
|
|
85
|
-
|
|
86
|
-
- **use-form-gql:** context type
|
|
87
|
-
([f355495](https://github.com/ho-nl/m2-pwa/commit/f3554951697fe394a76dd75ecf119f038f8d9bbc))
|
|
79
|
+
- add x-recaptcha header to apollo link context when using mutations ([380fe52](https://github.com/ho-nl/m2-pwa/commit/380fe52ebd283df034d8a2c6a4f6a3713955bdd3))
|
|
80
|
+
- **use-form-gql:** context type ([f355495](https://github.com/ho-nl/m2-pwa/commit/f3554951697fe394a76dd75ecf119f038f8d9bbc))
|
|
88
81
|
|
|
89
82
|
### Features
|
|
90
83
|
|
|
91
|
-
- google recaptcha v3 integration
|
|
92
|
-
([a9fcc16](https://github.com/ho-nl/m2-pwa/commit/a9fcc16f93951e61378c99a2e183e2d754da1d50))
|
|
84
|
+
- google recaptcha v3 integration ([a9fcc16](https://github.com/ho-nl/m2-pwa/commit/a9fcc16f93951e61378c99a2e183e2d754da1d50))
|
|
93
85
|
|
|
94
86
|
## [2.102.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/react-hook-form@2.102.0...@graphcommerce/react-hook-form@2.102.1) (2021-09-27)
|
|
95
87
|
|
|
@@ -99,117 +91,72 @@ All notable changes to this project will be documented in this file. See
|
|
|
99
91
|
|
|
100
92
|
### Bug Fixes
|
|
101
93
|
|
|
102
|
-
- disable isValid form checkout on submit
|
|
103
|
-
|
|
104
|
-
-
|
|
105
|
-
|
|
106
|
-
-
|
|
107
|
-
|
|
108
|
-
-
|
|
109
|
-
|
|
110
|
-
-
|
|
111
|
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
- **react-hook-form:**
|
|
115
|
-
|
|
116
|
-
- **react-hook-form:**
|
|
117
|
-
|
|
118
|
-
-
|
|
119
|
-
|
|
120
|
-
-
|
|
121
|
-
|
|
122
|
-
- **react-hook-form:** not not always submit ComposedForm
|
|
123
|
-
([642833f](https://github.com/ho-nl/m2-pwa/commit/642833fe8b311b20db2ccdd57f0492b8429c0e81))
|
|
124
|
-
- **react-hook-form:** Object(…) is not a function
|
|
125
|
-
([ebc32e4](https://github.com/ho-nl/m2-pwa/commit/ebc32e402c1db185785f1e29c21a705d38a6743d))
|
|
126
|
-
- **react-hook-form:** solve issue where form would oversubmit/not-submit
|
|
127
|
-
([89f0619](https://github.com/ho-nl/m2-pwa/commit/89f0619051228c08a61aafeeddb67b95e99727ff))
|
|
128
|
-
- **react-hook-form:** the wrong form would submit if the component didn’t rerender
|
|
129
|
-
([32d4cf1](https://github.com/ho-nl/m2-pwa/commit/32d4cf13ffc2967cc41e50a14ad872d289d4eb43))
|
|
130
|
-
- **react-hook-form:** validate if the previous request succeeds before moving on to the next
|
|
131
|
-
request
|
|
132
|
-
([1985d09](https://github.com/ho-nl/m2-pwa/commit/1985d0938cd509532fa3b6bc801a3399c2baae09))
|
|
133
|
-
- remove cyclic dependencies
|
|
134
|
-
([8a59389](https://github.com/ho-nl/m2-pwa/commit/8a5938943a97634cce57c68bb369c6e77e7a0288))
|
|
135
|
-
- show form checkmarks when field is valid
|
|
136
|
-
([7df8cad](https://github.com/ho-nl/m2-pwa/commit/7df8cadd5292c7d8a1d1e4c981d51adf7b5b8119))
|
|
137
|
-
- use form auto submit should submit with prefilled data
|
|
138
|
-
([9957ef6](https://github.com/ho-nl/m2-pwa/commit/9957ef67ee39e30873f528ffae4da7c0dcfbb6fa))
|
|
139
|
-
- useformautosubmit initial submit
|
|
140
|
-
([a06cb60](https://github.com/ho-nl/m2-pwa/commit/a06cb60996f83788a95bcd3995407539b2acfd46))
|
|
141
|
-
- useFormAutoSubmit modes
|
|
142
|
-
([9180bf2](https://github.com/ho-nl/m2-pwa/commit/9180bf21a140f5741078007c42972ded433c277c))
|
|
94
|
+
- disable isValid form checkout on submit ([b20110d](https://github.com/ho-nl/m2-pwa/commit/b20110d93327ff2678296acc47b1075b4fb3a85a))
|
|
95
|
+
- ignore md files from triggering version updates ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
|
|
96
|
+
- input checkmarks ([279c1c1](https://github.com/ho-nl/m2-pwa/commit/279c1c112ada46fdea102024298e8293d1a23293))
|
|
97
|
+
- make sure ComposedForm actually submits correctly ([c6499d9](https://github.com/ho-nl/m2-pwa/commit/c6499d9d36f874cd65b310cbf7f63f5a88fa86cd))
|
|
98
|
+
- make sure the checkout address fields are working as expected ([e88aae9](https://github.com/ho-nl/m2-pwa/commit/e88aae9afa3c60457b8e8c87ba52e8ae2dec4a3e))
|
|
99
|
+
- make sure useFormGqlQuery uses the new useLazyQueryPromise ([f0cf831](https://github.com/ho-nl/m2-pwa/commit/f0cf83191dbbc2da222682b053db8b8c374add69))
|
|
100
|
+
- **react-hook-form:** assertFormGqlOperation ([ce09fa5](https://github.com/ho-nl/m2-pwa/commit/ce09fa50f73f6d06b2caa15b1223ba7470a7ea96))
|
|
101
|
+
- **react-hook-form:** form autosubmit is stuck in a loop if the request fails ([c74e3e0](https://github.com/ho-nl/m2-pwa/commit/c74e3e0cbf146887c3ef5447dcbba46746971e2a))
|
|
102
|
+
- **react-hook-form:** handle ComposedForm network errors ([e028ae0](https://github.com/ho-nl/m2-pwa/commit/e028ae06f49fea5d4e4dbdf58f803b365c902404))
|
|
103
|
+
- **react-hook-form:** make sure we don’t overuse useFormPersist ([b28efde](https://github.com/ho-nl/m2-pwa/commit/b28efde79dad1fb9bf9e8d7f9cc5cf32648acdf1))
|
|
104
|
+
- **react-hook-form:** not not always submit ComposedForm ([642833f](https://github.com/ho-nl/m2-pwa/commit/642833fe8b311b20db2ccdd57f0492b8429c0e81))
|
|
105
|
+
- **react-hook-form:** Object(…) is not a function ([ebc32e4](https://github.com/ho-nl/m2-pwa/commit/ebc32e402c1db185785f1e29c21a705d38a6743d))
|
|
106
|
+
- **react-hook-form:** solve issue where form would oversubmit/not-submit ([89f0619](https://github.com/ho-nl/m2-pwa/commit/89f0619051228c08a61aafeeddb67b95e99727ff))
|
|
107
|
+
- **react-hook-form:** the wrong form would submit if the component didn’t rerender ([32d4cf1](https://github.com/ho-nl/m2-pwa/commit/32d4cf13ffc2967cc41e50a14ad872d289d4eb43))
|
|
108
|
+
- **react-hook-form:** validate if the previous request succeeds before moving on to the next request ([1985d09](https://github.com/ho-nl/m2-pwa/commit/1985d0938cd509532fa3b6bc801a3399c2baae09))
|
|
109
|
+
- remove cyclic dependencies ([8a59389](https://github.com/ho-nl/m2-pwa/commit/8a5938943a97634cce57c68bb369c6e77e7a0288))
|
|
110
|
+
- show form checkmarks when field is valid ([7df8cad](https://github.com/ho-nl/m2-pwa/commit/7df8cadd5292c7d8a1d1e4c981d51adf7b5b8119))
|
|
111
|
+
- use form auto submit should submit with prefilled data ([9957ef6](https://github.com/ho-nl/m2-pwa/commit/9957ef67ee39e30873f528ffae4da7c0dcfbb6fa))
|
|
112
|
+
- useformautosubmit initial submit ([a06cb60](https://github.com/ho-nl/m2-pwa/commit/a06cb60996f83788a95bcd3995407539b2acfd46))
|
|
113
|
+
- useFormAutoSubmit modes ([9180bf2](https://github.com/ho-nl/m2-pwa/commit/9180bf21a140f5741078007c42972ded433c277c))
|
|
143
114
|
|
|
144
115
|
### Features
|
|
145
116
|
|
|
146
|
-
- created stacked-pages package
|
|
147
|
-
|
|
148
|
-
- implemented
|
|
149
|
-
|
|
150
|
-
-
|
|
151
|
-
|
|
152
|
-
-
|
|
153
|
-
|
|
154
|
-
-
|
|
155
|
-
|
|
156
|
-
-
|
|
157
|
-
|
|
158
|
-
-
|
|
159
|
-
|
|
160
|
-
-
|
|
161
|
-
|
|
162
|
-
- **react-hook-form:** pass useFormGql operation options
|
|
163
|
-
([ddb6f75](https://github.com/ho-nl/m2-pwa/commit/ddb6f750432c0a6ed8468ae08e522a774c261f8f))
|
|
164
|
-
- **react-hook-form:** updated readme
|
|
165
|
-
([aede77a](https://github.com/ho-nl/m2-pwa/commit/aede77ab6d30fe5ca47b9d08bbdadca9b371713c))
|
|
166
|
-
- renamed all packages to use [@graphcommerce](https://github.com/graphcommerce) instead of
|
|
167
|
-
[@reachdigital](https://github.com/reachdigital)
|
|
168
|
-
([491e4ce](https://github.com/ho-nl/m2-pwa/commit/491e4cec9a2686472dac36b79f999257c0811ffe))
|
|
169
|
-
- search result page wip
|
|
170
|
-
([4ecaf34](https://github.com/ho-nl/m2-pwa/commit/4ecaf34deaa0ff6d24e03d72e74fd045bb7ee269))
|
|
171
|
-
- solve issue where the order couldn’t be submitted
|
|
172
|
-
([ec0d357](https://github.com/ho-nl/m2-pwa/commit/ec0d3579a1277976e2dc515f420996cf716f83a6))
|
|
173
|
-
- submit composed form sequentially
|
|
174
|
-
([890d839](https://github.com/ho-nl/m2-pwa/commit/890d8393d635c3777aa17cfa8d4dafc13c2e6cdc))
|
|
175
|
-
- upgrade to node 14
|
|
176
|
-
([d079a75](https://github.com/ho-nl/m2-pwa/commit/d079a751e9bfd8dc7f5009d2c9f31c336a0c96ab))
|
|
177
|
-
- useFormMutationCart and simpler imports
|
|
178
|
-
([012f090](https://github.com/ho-nl/m2-pwa/commit/012f090e8f54d09f35d393c61ad1e2319f5a90ff))
|
|
117
|
+
- created stacked-pages package ([d86008e](https://github.com/ho-nl/m2-pwa/commit/d86008ee659ccb25b194a41d624b394a1ddbd088))
|
|
118
|
+
- implemented checkmo payment method ([18525b2](https://github.com/ho-nl/m2-pwa/commit/18525b2f4efe9bd0eea12a7a992d284f341e0c68))
|
|
119
|
+
- implemented purchase order ([3a40033](https://github.com/ho-nl/m2-pwa/commit/3a40033cd4d6712a17bb9c41a8841ebf7aa2f025))
|
|
120
|
+
- introduced SheetShell as a shared layout component ([eb64f28](https://github.com/ho-nl/m2-pwa/commit/eb64f28fd05b69efbf14fa850c70b0f1da5c4237))
|
|
121
|
+
- next.js 11 ([7d61407](https://github.com/ho-nl/m2-pwa/commit/7d614075a778f488045034f74be4f75b93f63c43))
|
|
122
|
+
- **playwright:** added new playwright package to enable browser testing ([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9))
|
|
123
|
+
- **react-hook-form:** added buttonState to ComposedSubmit ([57e77c2](https://github.com/ho-nl/m2-pwa/commit/57e77c29f17720f7f3ee3b63be82779c0e5d8714))
|
|
124
|
+
- **react-hook-form:** added ComposedForm component to handle the submission of multiple forms ([1172ec5](https://github.com/ho-nl/m2-pwa/commit/1172ec5abcb0e1b72bb362b977bf0c22997bac9a))
|
|
125
|
+
- **react-hook-form:** pass useFormGql operation options ([ddb6f75](https://github.com/ho-nl/m2-pwa/commit/ddb6f750432c0a6ed8468ae08e522a774c261f8f))
|
|
126
|
+
- **react-hook-form:** updated readme ([aede77a](https://github.com/ho-nl/m2-pwa/commit/aede77ab6d30fe5ca47b9d08bbdadca9b371713c))
|
|
127
|
+
- renamed all packages to use [@graphcommerce](https://github.com/graphcommerce) instead of [@reachdigital](https://github.com/reachdigital) ([491e4ce](https://github.com/ho-nl/m2-pwa/commit/491e4cec9a2686472dac36b79f999257c0811ffe))
|
|
128
|
+
- search result page wip ([4ecaf34](https://github.com/ho-nl/m2-pwa/commit/4ecaf34deaa0ff6d24e03d72e74fd045bb7ee269))
|
|
129
|
+
- solve issue where the order couldn’t be submitted ([ec0d357](https://github.com/ho-nl/m2-pwa/commit/ec0d3579a1277976e2dc515f420996cf716f83a6))
|
|
130
|
+
- submit composed form sequentially ([890d839](https://github.com/ho-nl/m2-pwa/commit/890d8393d635c3777aa17cfa8d4dafc13c2e6cdc))
|
|
131
|
+
- upgrade to node 14 ([d079a75](https://github.com/ho-nl/m2-pwa/commit/d079a751e9bfd8dc7f5009d2c9f31c336a0c96ab))
|
|
132
|
+
- useFormMutationCart and simpler imports ([012f090](https://github.com/ho-nl/m2-pwa/commit/012f090e8f54d09f35d393c61ad1e2319f5a90ff))
|
|
179
133
|
|
|
180
134
|
### Reverts
|
|
181
135
|
|
|
182
|
-
- Revert "chore: upgrade @apollo/client"
|
|
183
|
-
([55ff24e](https://github.com/ho-nl/m2-pwa/commit/55ff24ede0e56c85b8095edadadd1ec5e0b1b8d2))
|
|
136
|
+
- Revert "chore: upgrade @apollo/client" ([55ff24e](https://github.com/ho-nl/m2-pwa/commit/55ff24ede0e56c85b8095edadadd1ec5e0b1b8d2))
|
|
184
137
|
|
|
185
138
|
# Change Log
|
|
186
139
|
|
|
187
|
-
All notable changes to this project will be documented in this file. See
|
|
188
|
-
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
140
|
+
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
189
141
|
|
|
190
142
|
## [2.101.4](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/react-hook-form@2.101.3...@graphcommerce/react-hook-form@2.101.4) (2021-08-09)
|
|
191
143
|
|
|
192
144
|
### Reverts
|
|
193
145
|
|
|
194
|
-
- Revert "chore: upgrade @apollo/client"
|
|
195
|
-
([55ff24e](https://github.com/ho-nl/m2-pwa/commit/55ff24ede0e56c85b8095edadadd1ec5e0b1b8d2))
|
|
146
|
+
- Revert "chore: upgrade @apollo/client" ([55ff24e](https://github.com/ho-nl/m2-pwa/commit/55ff24ede0e56c85b8095edadadd1ec5e0b1b8d2))
|
|
196
147
|
|
|
197
148
|
## [2.101.3](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/react-hook-form@2.101.2...@graphcommerce/react-hook-form@2.101.3) (2021-07-29)
|
|
198
149
|
|
|
199
150
|
### Bug Fixes
|
|
200
151
|
|
|
201
|
-
- **react-hook-form:** validate if the previous request succeeds before moving on to the next
|
|
202
|
-
request
|
|
203
|
-
([1985d09](https://github.com/ho-nl/m2-pwa/commit/1985d0938cd509532fa3b6bc801a3399c2baae09))
|
|
152
|
+
- **react-hook-form:** validate if the previous request succeeds before moving on to the next request ([1985d09](https://github.com/ho-nl/m2-pwa/commit/1985d0938cd509532fa3b6bc801a3399c2baae09))
|
|
204
153
|
|
|
205
154
|
# [2.101.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/react-hook-form@2.100.10...@graphcommerce/react-hook-form@2.101.0) (2021-07-26)
|
|
206
155
|
|
|
207
156
|
### Bug Fixes
|
|
208
157
|
|
|
209
|
-
- ignore md files from triggering version updates
|
|
210
|
-
([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
|
|
158
|
+
- ignore md files from triggering version updates ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
|
|
211
159
|
|
|
212
160
|
### Features
|
|
213
161
|
|
|
214
|
-
- **playwright:** added new playwright package to enable browser testing
|
|
215
|
-
([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9))
|
|
162
|
+
- **playwright:** added new playwright package to enable browser testing ([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9))
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/react-hook-form",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.6",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": "14.x"
|
|
@@ -15,17 +15,19 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@graphcommerce/eslint-config-pwa": "^4.
|
|
19
|
-
"@graphcommerce/prettier-config-pwa": "^4.0.
|
|
18
|
+
"@graphcommerce/eslint-config-pwa": "^4.1.3",
|
|
19
|
+
"@graphcommerce/prettier-config-pwa": "^4.0.5",
|
|
20
20
|
"@graphcommerce/typescript-config-pwa": "^4.0.2",
|
|
21
|
-
"@playwright/test": "^1.
|
|
21
|
+
"@playwright/test": "^1.20.1",
|
|
22
|
+
"type-fest": "2.12.1"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
|
-
"@apollo/client": "^3.5.
|
|
25
|
+
"@apollo/client": "^3.5.10",
|
|
25
26
|
"graphql": "^16.3.0",
|
|
27
|
+
"react-hook-form": "7.28.1"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
26
30
|
"react": "^17.0.2",
|
|
27
|
-
"react-dom": "^17.0.2"
|
|
28
|
-
"react-hook-form": "7.27.1",
|
|
29
|
-
"type-fest": "^2.12.0"
|
|
31
|
+
"react-dom": "^17.0.2"
|
|
30
32
|
}
|
|
31
33
|
}
|
|
@@ -4,7 +4,7 @@ import { composedFormReducer } from './reducer'
|
|
|
4
4
|
|
|
5
5
|
export type ComposedFormProps = { children?: React.ReactNode }
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export function ComposedForm(props: ComposedFormProps) {
|
|
8
8
|
const { children } = props
|
|
9
9
|
|
|
10
10
|
const [state, dispatch] = useReducer(composedFormReducer, {
|
|
@@ -18,7 +18,7 @@ export function mergeErrors(errors: ApolloError[]): ApolloError | undefined {
|
|
|
18
18
|
})
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export
|
|
21
|
+
export function ComposedSubmit(props: ComposedSubmitProps) {
|
|
22
22
|
const { render: Render, onSubmitSuccessful } = props
|
|
23
23
|
const [formContext, dispatch] = useContext(composedFormContext)
|
|
24
24
|
const { formState, buttonState, isCompleting, forms } = formContext
|
|
@@ -63,7 +63,7 @@ export default function ComposedSubmit(props: ComposedSubmitProps) {
|
|
|
63
63
|
* Todo: There might be a performance optimization by submitting multiple forms in parallel.
|
|
64
64
|
*/
|
|
65
65
|
let canSubmit = true
|
|
66
|
-
for (const [, { submit, form
|
|
66
|
+
for (const [, { submit, form }] of formsToSubmit) {
|
|
67
67
|
// eslint-disable-next-line no-await-in-loop
|
|
68
68
|
if (canSubmit) await submit?.()
|
|
69
69
|
// eslint-disable-next-line no-await-in-loop
|
package/src/diff.ts
CHANGED
|
@@ -30,7 +30,7 @@ export default function diff(item1: unknown, item2: unknown) {
|
|
|
30
30
|
.map(([key, val]) => [key, diff(item1[key], val)])
|
|
31
31
|
.filter((entry) => !!entry[1]),
|
|
32
32
|
)
|
|
33
|
-
const entries = { ...entriesRight, ...entriesLeft }
|
|
33
|
+
const entries = { ...entriesRight, ...entriesLeft } as Record<string, unknown>
|
|
34
34
|
|
|
35
35
|
return Object.keys(entries).length ? entries : undefined
|
|
36
36
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
1
2
|
import { debounce } from '@mui/material'
|
|
2
3
|
import { useCallback, useEffect, useState } from 'react'
|
|
3
4
|
import { FieldPath, FieldValues, UseFormReturn } from 'react-hook-form'
|
|
@@ -73,7 +74,7 @@ export function useFormAutoSubmit<Form extends UseFormReturn<V>, V = FieldValues
|
|
|
73
74
|
if (canSubmit && (force || shouldSubmit)) {
|
|
74
75
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
75
76
|
submitDebounced()
|
|
76
|
-
return submitDebounced.clear
|
|
77
|
+
return () => submitDebounced.clear()
|
|
77
78
|
}
|
|
78
79
|
return () => {}
|
|
79
80
|
}, [canSubmit, force, shouldSubmit, submitDebounced])
|
|
@@ -5,7 +5,9 @@ import { useFormMuiRegister, UseMuiFormRegister } from './useFormMuiRegister'
|
|
|
5
5
|
import { useFormValidFields, UseFormValidReturn } from './useFormValidFields'
|
|
6
6
|
|
|
7
7
|
export type UseFormGqlMutationReturn<
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
9
|
Q extends Record<string, any> = Record<string, any>,
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
11
|
V extends Record<string, any> = Record<string, any>,
|
|
10
12
|
> = UseFormGqlMethods<Q, V> &
|
|
11
13
|
UseFormReturn<V> & { muiRegister: UseMuiFormRegister<V>; valid: UseFormValidReturn<V> }
|
|
@@ -53,6 +53,7 @@ export type DeepIsRequired<V> = {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
type DeepStringify<V> = {
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
56
57
|
[k in keyof V]?: V[k] extends (infer U)[]
|
|
57
58
|
? string[]
|
|
58
59
|
: V[k] extends Record<string, unknown>
|
|
@@ -125,7 +126,9 @@ export function handlerFactory<Q, V>(document: TypedDocumentNode<Q, V>): UseGqlD
|
|
|
125
126
|
function encodeItem(enc: FieldTypes, val: unknown) {
|
|
126
127
|
if (Array.isArray(enc)) return [encodeItem(enc[0], val)]
|
|
127
128
|
if (val && typeof val === 'object') {
|
|
128
|
-
return Object.fromEntries(
|
|
129
|
+
return Object.fromEntries(
|
|
130
|
+
Object.entries(val).map(([key, v]) => [key, heuristicEncode(v as string)]),
|
|
131
|
+
)
|
|
129
132
|
}
|
|
130
133
|
if (enc === 'Boolean') return Boolean(val)
|
|
131
134
|
if (enc === 'Float' || enc === 'Int') return Number(val)
|
|
@@ -134,7 +137,7 @@ export function handlerFactory<Q, V>(document: TypedDocumentNode<Q, V>): UseGqlD
|
|
|
134
137
|
|
|
135
138
|
function encode(variables: { [k in keyof V]?: DeepStringify<V[k]> }, enc = encoding) {
|
|
136
139
|
return Object.fromEntries(
|
|
137
|
-
Object.entries(variables).map(([key, val]) => [key, encodeItem(enc[key], val)]),
|
|
140
|
+
Object.entries(variables).map(([key, val]) => [key, encodeItem(enc[key] as FieldTypes, val)]),
|
|
138
141
|
) as V
|
|
139
142
|
}
|
|
140
143
|
|
|
@@ -33,6 +33,7 @@ export function useLazyQueryPromise<Q, V>(
|
|
|
33
33
|
}, [result])
|
|
34
34
|
|
|
35
35
|
const queryLazily = (executeOptions?: QueryLazyOptions<V>) => {
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
36
37
|
execute(executeOptions)
|
|
37
38
|
return new Promise<LazyQueryResult<Q, V>>((resolve) => {
|
|
38
39
|
ref.current = resolve
|