Skip to content

Commit c9a822d

Browse files
committed
[2.5.2] Fixed reinitialization for Array values
1 parent 7c961f7 commit c9a822d

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
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.2
2+
3+
### Fixed
4+
5+
- Reinitialization for Array values
6+
17
## 2.5.1
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.2](/CHANGELOG.md#252)
8283
- [2.5.1](/CHANGELOG.md#251)
8384
- [2.5.0](/CHANGELOG.md#250)
8485
- [2.4.2](/CHANGELOG.md#242)

VueForm/components/Form/Form.js

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

272272
reinitializeValues(updatedInitialValues) {
273-
this.state = mapValues(this.state, (value, key) => updatedInitialValues[key])
273+
this.state = mapValues(
274+
this.state,
275+
(value, key) => isNil(updatedInitialValues[key]) || (Array.isArray(value) ? [] : undefined)
276+
)
274277
this.syncErrors = {}
275278
this.asyncErrors = {}
276279
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.1",
3+
"version": "2.5.2",
44
"description": "Form State Management for VueJS",
55
"main": "VueForm/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)