Skip to content

Commit 54c6723

Browse files
committed
[2.5.3] Fixed reinitialization for all values types except Array
1 parent c9a822d commit 54c6723

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 2.5.3
2+
3+
### Fixed
4+
5+
- Reinitialization for all values types except Array
6+
17
## 2.5.2
28

39
### Fixed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ See demo at [https://detools.github.io/vue-form](https://detools.github.io/vue-f
7979

8080
## Changelog
8181

82+
- [2.5.3](/CHANGELOG.md#253)
8283
- [2.5.2](/CHANGELOG.md#252)
8384
- [2.5.1](/CHANGELOG.md#251)
8485
- [2.5.0](/CHANGELOG.md#250)

VueForm/components/Form/Form.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,13 @@ export default {
270270
},
271271

272272
reinitializeValues(updatedInitialValues) {
273-
this.state = mapValues(
274-
this.state,
275-
(value, key) => isNil(updatedInitialValues[key]) || (Array.isArray(value) ? [] : undefined)
276-
)
273+
this.state = mapValues(this.state, (value, key) => {
274+
if (!isNil(updatedInitialValues[key])) {
275+
return updatedInitialValues[key]
276+
}
277+
278+
return Array.isArray(value) ? [] : undefined
279+
})
277280
this.syncErrors = {}
278281
this.asyncErrors = {}
279282
this.touchedFields = {}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@detools/vue-form",
3-
"version": "2.5.2",
3+
"version": "2.5.3",
44
"description": "Form State Management for VueJS",
55
"main": "VueForm/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)