-
Notifications
You must be signed in to change notification settings - Fork 77
lastModified changes when loading distant related objects #140
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
Comments
This is a good point. Wasn't really an issue until it became easy to link up the relations. |
@Patrik-Lundqvist I think I might have fixed this. Can you try it again with the latest master? |
It now updates properly for object properties like when changing name for a user. But now there is no way of detecting addition/deletion changes for a collection property in an object, like the user posts collection. It would be nice if one could watch direct collection changes with something like this: $scope.$watch(function () {
return DS.lastModified('user', 1, ['posts']);
}, function () {
console.log("User 1 posts has changed");
});
DS.inject('post', {id:1, content: 'test', userId: 1},{linkInverse: true});
// This should log "User 1 posts has changed" Or maybe just update lastModified for the user on additions/deletions in the posts collection |
Unfortunately, You could do: $scope.$watch(function () {
return DS.lastModified('user', 1) + DS.lastModified('post');
}, function () {
console.log("User 1 or posts has changed");
}); |
Yeah, I thought so. Well that might be another issue, this fix works as intended. |
Okay |
DS.lastModified will change when a distant object gets loaded which makes it hard to detect changes for a specific object.
This makes it very hard to know when user 1 is updated. lastModified should probably only change when its own properties are changed (name and additions/deletions to its posts collection).
The text was updated successfully, but these errors were encountered: