-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Single Object Notifications #4101
Comments
Does this API provide an ability to get notification when a linked object is changed? |
I don't believe so. If I remember correctly that is the default behaviour on .NET and the rationale being that if you care about changes to a linked object you should register the listener there instead. That argument makes sense, although I can see supporting it would probably lead to a more natural syntax in code:
Navigating back to parents automatically would require backlink support though. We already have that in Core, so theoretically we could probably do it without exposing it in the public API first. In any case, I think supporting linked fields should probably be left for a 2nd iteration of this. |
@cmelchior In version A, users need to keep the reference to But yes, this should be supported in another issue. |
also it should be triggered when the object gets deleted. See #3138 |
- Add RowObject for wrapping Object Store's Object class. - Enabled detailed object notification. - Add RealmObjectChangeListener, ObjectChangeSet. - Fix false positive change notifications for RealmObject. Now the notification will only be sent when the object actually changes. See #4101
The proposed API can be seen in #4331 See:
Move discussion to #4331 |
See #4101 - Add ObjectChangeSet & RealmObjectChangeListener. - Add OsObject to wrap ObjectStore's Object for notifications. - No more false positive notifications for RealmObject. - Use ObserverPairList in ProxyState instead of normal list to solve the potential listener removal problems which is handled well by the ObserverPairList. - Fix tests.
Motivation
realm/realm-object-store#324 added support for single object notifications to the Object Store
realm/realm-swift#4537 is adding the public API's on the Cocoa side.
We should add similar capabilities to Android.
Use cases
Object change listeners will now only be called if the object actually changed. It should reduce the number of unnecessary updates which is happening right now due to the change notification being table based.
It should make it possible to register listeners for a single field value, e.g. if the UI should only be refreshed if a single field changed.
It should be possible to register a listener on an object and be give the old and new values, e.g. useful if you only need to refresh the UI if a String changed in a particular way.
It should now be possible to be notified when an object is deleted. See findFirstAsync is not emitting object when queried object is deleted from Realm #3138. Realm classes only implementing "RealmModel" might be tricky to support.
We should strive for easy integration with Databinding https://developer.android.com/topic/libraries/data-binding/index.html. How this should be done is still undecided.
This issue consists of the following tasks:
extends RealmObject
andimplements RealmModel
.The text was updated successfully, but these errors were encountered: