objectbox / objectbox/objectbox-java
Improve DataObserver reference holding
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.6k
- Forks
- 311
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to use obervable queries to detect when the user is logged in my application in order to start fetching data in background with correct authorization token.
...
userBox.query().build().subscribe().observe(users -> fetchUserData());
...
boxStore.subscribe(User.class).observe(class -> fetchUserData());
First "live" query doesn't work whilst the second works fine whenever I put(user) a new user in the userBox.
Is this correct? I'm not sure from which thread the user is being inserted, might this be an issue?
Does it make sense to use a "live" query to observe the insertion of new objects or is it just for changes in existing objects?
Live queries would be great, for my application and are the main feature that made me pick ObjectBox, hope I can get it working.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing DataObserver and the live-query subscription paths described in the report, then compare them with boxStore.subscribe(User.class). Check how query references are held and which thread handles inserts. Done means the live query reliably observes newly inserted users, with behavior clarified or covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100