Skip to content

Commit

Permalink
fix: fix $onFormChange before Form mount
Browse files Browse the repository at this point in the history
  • Loading branch information
qiqiboy committed Nov 26, 2020
1 parent 8e0ac92 commit 69976c5
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 12 deletions.
5 changes: 3 additions & 2 deletions dist/react-formutil.cjs.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,7 @@ var Form = /*#__PURE__*/function (_Component) {
var pathData = pathExist($parsedTree, name);

if (force || pathData) {
var $curState = handler.$getState();
var $newState = handler && processer(pathData && pathData.data, handler);

if ($newState) {
Expand All @@ -916,11 +917,11 @@ var Form = /*#__PURE__*/function (_Component) {

if (findItem) {
findItem.$newValue = $newValue;
} else if (name in _this.$formutil.$weakParams) {
} else {
_this.$$fieldChangedQueue.push({
name: name,
$newValue: $newValue,
$prevValue: _this.$formutil.$weakParams[name]
$prevValue: $curState.$value
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/react-formutil.cjs.production.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions dist/react-formutil.esm.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@ var Form = /*#__PURE__*/function (_Component) {
var pathData = pathExist($parsedTree, name);

if (force || pathData) {
var $curState = handler.$getState();
var $newState = handler && processer(pathData && pathData.data, handler);

if ($newState) {
Expand All @@ -849,11 +850,11 @@ var Form = /*#__PURE__*/function (_Component) {

if (findItem) {
findItem.$newValue = $newValue;
} else if (name in _this.$formutil.$weakParams) {
} else {
_this.$$fieldChangedQueue.push({
name: name,
$newValue: $newValue,
$prevValue: _this.$formutil.$weakParams[name]
$prevValue: $curState.$value
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/react-formutil.esm.production.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions dist/react-formutil.umd.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,7 @@
var pathData = pathExist($parsedTree, name);

if (force || pathData) {
var $curState = handler.$getState();
var $newState = handler && processer(pathData && pathData.data, handler);

if ($newState) {
Expand All @@ -1209,11 +1210,11 @@

if (findItem) {
findItem.$newValue = $newValue;
} else if (name in _this.$formutil.$weakParams) {
} else {
_this.$$fieldChangedQueue.push({
name: name,
$newValue: $newValue,
$prevValue: _this.$formutil.$weakParams[name]
$prevValue: $curState.$value
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/react-formutil.umd.production.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-formutil",
"version": "1.1.1",
"version": "1.1.2",
"description": "Happy to build the forms in React ^_^",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
Expand Down
5 changes: 3 additions & 2 deletions src/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ class Form extends Component {
const pathData = utils.pathExist($parsedTree, name);

if (force || pathData) {
const $curState = handler.$getState();
const $newState = handler && processer(pathData && pathData.data, handler);

if ($newState) {
Expand All @@ -378,11 +379,11 @@ class Form extends Component {

if (findItem) {
findItem.$newValue = $newValue;
} else if (name in this.$formutil.$weakParams) {
} else {
this.$$fieldChangedQueue.push({
name,
$newValue,
$prevValue: this.$formutil.$weakParams[name]
$prevValue: $curState.$value
});
}
}
Expand Down

0 comments on commit 69976c5

Please sign in to comment.