Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Field): getValues return initValue- #close 792 #807

Merged
merged 5 commits into from
Jul 3, 2019

Conversation

jdkahn
Copy link
Contributor

@jdkahn jdkahn commented Jun 20, 2019

  • if getValues is called before init, should return initValue
  • getIn, setIn unit tests

@jdkahn jdkahn requested a review from bindoon June 20, 2019 08:27
@codecov
Copy link

codecov bot commented Jun 20, 2019

Codecov Report

Merging #807 into feat/1.16.0 will decrease coverage by 6.55%.
The diff coverage is 94.91%.

Impacted file tree graph

@@               Coverage Diff               @@
##           feat/1.16.0     #807      +/-   ##
===============================================
- Coverage        91.28%   84.72%   -6.56%     
===============================================
  Files              244      244              
  Lines            14021    11287    -2734     
  Branches          4403     2806    -1597     
===============================================
- Hits             12799     9563    -3236     
+ Misses            1203      917     -286     
- Partials            19      807     +788
Impacted Files Coverage Δ
src/field/utils.js 93.42% <83.33%> (-1.1%) ⬇️
src/field/index.js 94.48% <97.87%> (+2.35%) ⬆️
src/tag/tag-group.jsx 50% <0%> (-50%) ⬇️
src/slider/slick/inner-slider.jsx 64.86% <0%> (-24.39%) ⬇️
src/form/enhance.jsx 64.86% <0%> (-21.14%) ⬇️
src/upload/runtime/index.jsx 71.42% <0%> (-20.24%) ⬇️
src/table/expanded/row.jsx 62.85% <0%> (-18.54%) ⬇️
src/balloon/inner.jsx 81.81% <0%> (-18.19%) ⬇️
src/cascader/menu.jsx 62.96% <0%> (-18.12%) ⬇️
src/range/utils.jsx 70% <0%> (-18%) ⬇️
... and 208 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a815d80...58bb645. Read the comment docs.

@jdkahn jdkahn changed the title fix(Field): getValues return initValue- #close 792 [WIP] fix(Field): getValues return initValue- #close 792 Jun 20, 2019
allValues = setIn(allValues, f, this.getValue(f));
}
});
} else if (this.initValue) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can not do this, because people use reset or remove to clear all value.

and he expect to get {}, but return initValue.

@bindoon
Copy link
Member

bindoon commented Jun 20, 2019

hold for this PR, we need do big change to Field to make it use more friendly.

- if getValues is called before init, should return initValue
- getIn, setIn unit tests
- getValues should not return disabled field values
@bindoon
Copy link
Member

bindoon commented Jun 24, 2019

we should also update values while onChange trigged.

- field.values is the new source of truth
- field.fieldsMeta is for initialized components
- disabled field support was broken, removed support
@@ -361,11 +375,21 @@ class Field {
this.setValue(name, fieldsValue[name], false);
});
} else {
// NOTE: this is a shallow merge
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add NOTE:
we have two values a.b.c=1 ; a.b.d=2, and use setValues({a:{b:{c:3}}}) , then because of shallow merge a.b.d will lost, we will get only {a:{b:{c:3}}}

@jdkahn jdkahn changed the base branch from master to feat/1.16.0 July 1, 2019 02:06
@jdkahn jdkahn changed the title [WIP] fix(Field): getValues return initValue- #close 792 fix(Field): getValues return initValue- #close 792 Jul 2, 2019
@youluna youluna merged commit 2459716 into alibaba-fusion:feat/1.16.0 Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants