fix(change_detection): update the right change detector when using ON_PUSH mode

Previously, in a case where you have a mix of ON_PUSH and DEFAULT detectors, Angular would update the status of a wrong detector.
This commit is contained in:
vsavkin
2015-08-19 10:48:53 -07:00
parent a0b240884b
commit 195c5c21d4
7 changed files with 52 additions and 53 deletions

View File

@ -226,7 +226,7 @@ class _CodegenState {
String _maybeGenHydrateDirectives() {
var hydrateDirectivesCode = _genHydrateDirectives();
var hydrateDetectorsCode = _genHydrateDetectors();
var hydrateDetectorsCode = _logic.genHydrateDetectors(_directiveRecords);
if (hydrateDirectivesCode.isEmpty && hydrateDetectorsCode.isEmpty) {
return '';
}
@ -244,16 +244,6 @@ class _CodegenState {
return '$buf';
}
String _genHydrateDetectors() {
var buf = new StringBuffer();
var detectorFieldNames = _names.getAllDetectorNames();
for (var i = 0; i < detectorFieldNames.length; ++i) {
buf.writeln('${detectorFieldNames[i]} = directives.getDetectorFor('
'${_names.getDirectivesAccessorName()}[$i].directiveIndex);');
}
return '$buf';
}
/// Generates calls to `onAllChangesDone` for all `Directive`s that request
/// them.
String _maybeGenCallOnAllChangesDone() {