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(uiGrid): Fix race condition in data watcher #4902

Merged
merged 1 commit into from
Dec 29, 2015
Merged

fix(uiGrid): Fix race condition in data watcher #4902

merged 1 commit into from
Dec 29, 2015

Conversation

oriondean
Copy link
Contributor

I introduced a guard to reduce some unnecessary calls to buildColumns and preCompileCellTemplates each time data is changed.

As a result, the $q.all promise in dataWatchFunction could resolve before promises created in previous calls. This is because an empty array of promises can be passed to $q.all the method now. This unearthed an issue where modifyRows could be passed outdated data from previous dataWatchFunction calls, rather than the most recent call.

Fixes #4532, issue introduced by #4428.

modifyRows is now passed the most recent data that the dataWatchFunction has seen
Fixes race condition when retrieving templates via URL.
$q.all promise in dataWatchFunction would resolve and pass in outdated
grid data from the original dataWatchFunction call.

Fixes #4532
@imbalind
Copy link
Contributor

@c0bra @swalters I'm not so deep into this, but some users have issues so I think merging this is quite high priority, can you have a look?

@oriondean
Copy link
Contributor Author

#2053 is a similar issue that @c0bra fixed a year ago (2b25f24).

It seems that the fix then was to prevent the promises from resolving out of order. This fix was reverted by the changes made in #4428. This PR doesn't fix the promises resolving out of order but instead prevents the wrong data being set if they do.

swalters added a commit that referenced this pull request Dec 29, 2015
fix(uiGrid): Fix race condition in data watcher
@swalters swalters merged commit 1dc9931 into angular-ui:master Dec 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom column/template not being rendered after v3.0.7
3 participants