local-first | data syncing, storage, and collaboration. that works | Data Processing library
kandi X-RAY | local-first Summary
kandi X-RAY | local-first Summary
data syncing, storage, and collaboration. that works
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of local-first
local-first Key Features
local-first Examples and Code Snippets
Community Discussions
Trending Discussions on local-first
QUESTION
I'm struggling while figuring how to raise a network error from the data layer to the view layer.
I'm using Room along with RxJava2 and Retrofit2. I'm implementing the repository pattern as local-first, so I query the local data, while fetching from the remote, and updating local data if neccesary. In code, this would be:
...ANSWER
Answered 2017-Sep-06 at 08:47You're not chaining these Observables here - thus an error from the API Observable will not propagate down the stream to the view layer. (moreover I'm not sure how Room operate but you will query it twice for the DB updates)
If I understands correctly, db.dEventDataStore().getAll()
created by Room so this Flowable
is infinite, listen to DB changes and emit any change. so you want to query server, and in case of data update the DB and expect emission from Room's DB Flowable.
in this case, you can do this in parallel using merge
, and the API Maybe, pass through just the errors by ignoring any elements it's emit. in this way the downstream we'll get the data emissions only from Room DB, while still getting server error notifications.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install local-first
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page