From 7206d9528727e1a09c6f77629cd5bdf998cd7990 Mon Sep 17 00:00:00 2001 From: Anton Kuznetsov Date: Tue, 11 Dec 2018 17:58:50 +0300 Subject: [PATCH] [2.7.8] Do deep equal of initialValues via lodash.isEqual on updated --- CHANGELOG.md | 6 ++++++ README.md | 1 + VueForm/components/Form/Form.js | 15 +++++++++++++-- package.json | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a35da2b..fc6c306 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.7.8 + +### Fixed + +- Do deep equal of `initialValues` via `lodash.isEqual` on `updated` + ## 2.7.7 ### Fixed diff --git a/README.md b/README.md index 0a5a662..c5a43d3 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ See demo at [https://detools.github.io/vue-form](https://detools.github.io/vue-f ## Changelog +- [2.7.8](/CHANGELOG.md#278) - [2.7.7](/CHANGELOG.md#277) - [2.7.6](/CHANGELOG.md#276) - [2.7.5](/CHANGELOG.md#275) diff --git a/VueForm/components/Form/Form.js b/VueForm/components/Form/Form.js index 5f5180a..51d2659 100644 --- a/VueForm/components/Form/Form.js +++ b/VueForm/components/Form/Form.js @@ -1,4 +1,15 @@ -import { isNil, isBoolean, isEmpty, has, mapValues, union, merge, without, omit } from 'lodash' +import { + isNil, + isBoolean, + isEmpty, + isEqual, + has, + mapValues, + union, + merge, + without, + omit, +} from 'lodash' import { Form, Button } from 'element-ui' import CONSTANTS from '../../constants' import { validate, asyncValidate } from '../../validators/validate' @@ -44,7 +55,7 @@ export default { }, updated() { - if (this.defaultInitialValues !== this.initialValues) { + if (!isEqual(this.defaultInitialValues, this.initialValues)) { this.defaultInitialValues = this.initialValues this.reinitializeValues(this.initialValues) } diff --git a/package.json b/package.json index 0dc7788..a1626ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@detools/vue-form", - "version": "2.7.7", + "version": "2.7.8", "description": "Form State Management for VueJS", "main": "VueForm/index.js", "scripts": {