Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

fix($compile): ensure isolated local watches lastValue is always in syn... #5182

Closed
wants to merge 1 commit into from

Conversation

dtabuenc
Copy link
Contributor

...c

When using two-way binding with isolate scope, under some circumstances
the lastValue variable captured in the parentValueWatch function can get
out of sync.

Specifically, if both the value in the origin scope as well as the value
in the isolate scope get independently updated to the same value within
one digest cycle, the lastValue is never updated. This potentially causes
the watch to make the wrong decision as to which side to update on subsequent
passes.

This fixes things by ensuring lastValue is always set to the last seen
value even if the watch's logic was shrot circuited because there was no
difference between the values in the original and isolate scopes.

…sync

When using two-way binding with isolate scope, under some circumstances
the lastValue variable captured in the parentValueWatch function can get
out of sync.

Specifically, if both the value in the origin scope as well as the value
in the isolate scope get independently updated to the same value within
one digest cycle, the lastValue is never updated. This potentially causes
the watch to make the wrong decision as to which side to update on subsequent
passes.

This fixes things by ensuring lastValue is always set to the last seen
value even if the watch's logic was shrot circuited because there was no
difference between the values in the original and isolate scopes.
@mary-poppins
Copy link

Thanks for the PR!

  • Contributor signed CLA now or in the past
    • If you just signed, leave a comment here with your real name
  • PR's commit messages follow the commit message format

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@petebacondarwin
Copy link
Contributor

@dtabuenc - Thanks for this PR - can you ensure that you have signed the CLA: https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#signing-the-cla

@dtabuenc
Copy link
Contributor Author

Yep, signed it before submitting the PR

@ghost ghost assigned tbosch Dec 2, 2013
@tbosch tbosch closed this in 2d0f6cc Dec 4, 2013
@tbosch
Copy link
Contributor

tbosch commented Dec 4, 2013

Thanks for this good PR: good description, good tests.

jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
…sync

When using two-way binding with isolate scope, under some circumstances
the lastValue variable captured in the parentValueWatch function can get
out of sync.

Specifically, if both the value in the origin scope as well as the value
in the isolate scope get independently updated to the same value within
one digest cycle, the lastValue is never updated. This potentially causes
the watch to make the wrong decision as to which side to update on subsequent
passes.

This fixes things by ensuring lastValue is always set to the last seen
value even if the watch's logic was short circuited because there was no
difference between the values in the original and isolate scopes.

Closes angular#5182
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
…sync

When using two-way binding with isolate scope, under some circumstances
the lastValue variable captured in the parentValueWatch function can get
out of sync.

Specifically, if both the value in the origin scope as well as the value
in the isolate scope get independently updated to the same value within
one digest cycle, the lastValue is never updated. This potentially causes
the watch to make the wrong decision as to which side to update on subsequent
passes.

This fixes things by ensuring lastValue is always set to the last seen
value even if the watch's logic was short circuited because there was no
difference between the values in the original and isolate scopes.

Closes angular#5182
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants