Comparing version 2.2.4 to 2.2.5
@@ -1,2 +0,2 @@ | ||
import { CancelablePromise } from './util/index'; | ||
import { CancelablePromise } from './util'; | ||
import Form from './Form'; | ||
@@ -3,0 +3,0 @@ export declare type Validator = (value: any, fields: { |
@@ -0,1 +1,2 @@ | ||
import equal from 'fast-deep-equal'; | ||
import { useCallback, useState, useEffect, useMemo } from 'react'; | ||
@@ -375,4 +376,8 @@ | ||
Field.prototype.setState = function (values) { | ||
this.state = __assign(__assign({}, this.state), values); | ||
this._events.dispatch('state change', this.state); | ||
var newState = __assign(__assign({}, this.state), values); | ||
var isEqual = equal(this.state, newState); | ||
if (!isEqual) { | ||
this.state = newState; | ||
this._events.dispatch('state change', this.state); | ||
} | ||
}; | ||
@@ -379,0 +384,0 @@ Field.prototype.setRef = function (node) { |
@@ -1,2 +0,2 @@ | ||
import { CancelablePromise } from './util/index'; | ||
import { CancelablePromise } from './util'; | ||
import Form from './Form'; | ||
@@ -3,0 +3,0 @@ export declare type Validator = (value: any, fields: { |
@@ -5,2 +5,5 @@ 'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var equal = _interopDefault(require('fast-deep-equal')); | ||
var react = require('react'); | ||
@@ -380,4 +383,8 @@ | ||
Field.prototype.setState = function (values) { | ||
this.state = __assign(__assign({}, this.state), values); | ||
this._events.dispatch('state change', this.state); | ||
var newState = __assign(__assign({}, this.state), values); | ||
var isEqual = equal(this.state, newState); | ||
if (!isEqual) { | ||
this.state = newState; | ||
this._events.dispatch('state change', this.state); | ||
} | ||
}; | ||
@@ -384,0 +391,0 @@ Field.prototype.setRef = function (node) { |
{ | ||
"name": "formular", | ||
"version": "2.2.4", | ||
"version": "2.2.5", | ||
"author": "Pavel Ivanov", | ||
@@ -58,3 +58,6 @@ "description": "Build forms in React. Easy-Peasy!", | ||
"typescript": "^3.8.3" | ||
}, | ||
"dependencies": { | ||
"fast-deep-equal": "^3.1.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
101418
1996
2
+ Addedfast-deep-equal@^3.1.1
+ Addedfast-deep-equal@3.1.3(transitive)