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

Support observing individual objects #126

Open
avestnik opened this issue Jun 30, 2017 · 7 comments
Open

Support observing individual objects #126

avestnik opened this issue Jun 30, 2017 · 7 comments
Labels
enhancement New feature or request

Comments

@avestnik
Copy link

while one can easily listen to changes to lists (queries), there is no way to listen to changes of some particular object

@greenrobot
Copy link
Member

That would be a feature request.

To better understand your use case: how many objects do you want to observe? Are you interested to observe object deletions?

@greenrobot greenrobot changed the title to how listen to object changes? Support observing individual objects Jul 6, 2017
@avestnik
Copy link
Author

avestnik commented Jul 6, 2017

typical use case is following:

  • there is a list of objects (models) I'd like to show on screen
  • list is presented by ListViewModel which exposes some kind of ObserableList <ItemViewModel> Items
  • each ItemViewModel wraps over model object from DAL
  • ItemViewModel exposes some kind of Observable interface to a view
  • ideally ItemViewModel should be able to subscribe to changes in model and translate those changes into changes of ItemViewModel

I would estimate that at the same time there could be up to 100 objects being observed.
deletions in my use case are handled in ListViewModel which subscribes to changes in query

@greenrobot
Copy link
Member

greenrobot commented Jul 6, 2017

So the source of initial list (entities) is not a query?

@avestnik
Copy link
Author

avestnik commented Jul 6, 2017

quite often it is, but I'd like to decouple ListVM and ItemVM and avoid listening to object changes via query listener

@greenrobot
Copy link
Member

@avestnik One advantage of list-based observers is that they cover removals and inserts. Wouldn't you still need those? If you do, does it make sense to also observe on the object level?

@avestnik
Copy link
Author

avestnik commented Jul 8, 2017

I need both, ListVM listens to inserts/deletions, ItemVM listens to object changes

@jarrodholliday
Copy link

This would be nice to have, but also still doable in the current iteration.
I also need to listen to both list and single object changes. For the single object changes I just do a query on the object id and wrap the DataSubscription with an Observable to emmit the only item in the list passed in the DataSubscription.observer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants