fix(ivy): OnChanges should support updating one Input among many (#28693)

PR Close #28693
This commit is contained in:
Marc Laval
2019-02-13 17:32:54 +01:00
committed by Misko Hevery
parent 36df9056af
commit 3842dd6a6d
3 changed files with 69 additions and 4 deletions

View File

@ -59,7 +59,16 @@ function wrapOnChanges() {
const current = simpleChangesStore && simpleChangesStore.current;
if (current) {
simpleChangesStore !.previous = current;
const previous = simpleChangesStore !.previous;
if (previous === EMPTY_OBJ) {
simpleChangesStore !.previous = current;
} else {
// New changes are copied to the previous store, so that we don't lose history for inputs
// which were not changed this time
for (let key in current) {
previous[key] = current[key];
}
}
simpleChangesStore !.current = null;
this.ngOnChanges(current);
}