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
Update query backing RealmResults for correct notifications when incrementally improving a query. #6216
Comments
In retrospect, it sounds really nice and also more efficient to filter a RealmResults in place, instead of creating a new RealmResults each time and hoping for GC to eliminate previously created result sets that may or may not have to be updated when a new version arrives (background thread write) |
Yes, I can definitely see the use case for filter UI's that incrementally changes while you want to retain nice animations. You are right that this is not supported very well in the current Java API's. I believe we discussed the use case internally at some point, but I cannot remember the conclusion right now, so I'll have to dig it up |
@cmelchior any updates? 😄 |
Yes, sorry for not writing it up. After a little digging, we don't have direct support for it right now, but nothing in the notification implementation should prevent us from doing this.. However, I cannot give you a concrete timeline at this point. For the matter of API I'm thinking something along the line of:
|
Hey - looks like you forgot to add a T:* label - could you please add one? |
Describe your problem or use case
I have a search input and a list rendered with
RealmRecyclerViewAdapter
(or a simple recylerview adapter for that matter, but getting changes fromasChangesetObservable()
). I want to filter that list based on user's input and get granular notifications for the adapter.Why am I using Realm? Because the chat-app I'm building is supposed to support lists with 2-3k items and I like the idea of not copying data into memory when rendering 3 of those lists in a viewpager.
What I'm doing right now:
I'm executing the
observeCampaigns
function each time the query changes and pass the RealmResults to the adapter.This doesn't work because I'm creating a new RealmResults each time and I'll always get
changeSet.getState() == OrderedCollectionChangeSet.State.INITIAL
inside theOrderedRealmCollectionChangeListener
of the adapter.Describe the solution you'd like
I need a way to filter RealmResults, or have the same query re-executed with different parameters so I get proper change notifications.
Additional context
I also wrote a stackoverflow question.
One bypass solution would be to use realm-monarchy to detach realm objects & get an Architecture Components PagedList. This seems counterintuitive and defeats the purpose of using Realm in the first place. I also made an issue on realm-monarchy for feedback.
I'm sorry for the ranty tone, but this seems such a trivial thing & I can't be the first person who wants to do this, right?
The text was updated successfully, but these errors were encountered: