fix(ivy): account for multiple changes between change detection runs (#24152)

PR Close #24152
This commit is contained in:
JoostK
2018-05-27 15:26:41 +02:00
committed by Victor Berchet
parent a5c47d0045
commit 2d9111bfb6
2 changed files with 9 additions and 3 deletions

View File

@ -272,7 +272,13 @@ export function NgOnChangesFeature(inputPropertyNames?: {[key: string]: string})
this, PRIVATE_PREFIX, {value: simpleChanges = {}, writable: true});
}
const isFirstChange = !this.hasOwnProperty(privateMinKey);
simpleChanges[propertyName] = new SimpleChange(this[privateMinKey], value, isFirstChange);
const currentChange: SimpleChange|undefined = simpleChanges[propertyName];
if (currentChange) {
currentChange.currentValue = value;
} else {
simpleChanges[propertyName] =
new SimpleChange(this[privateMinKey], value, isFirstChange);
}
if (isFirstChange) {
// Create a place where the actual value will be stored and make it non-enumerable
Object.defineProperty(this, privateMinKey, {value, writable: true});