Fetching resources and storing them on Pouchdb efficiently.

33 views
Skip to first unread message

Gustavo Reyes

unread,
May 30, 2017, 11:21:49 AM5/30/17
to PouchDB
 I'm still having a few issues with performance since I'm using pouchdb on an Ionic app. I was wondering if you could have a better idea of how to solve my case.

I'm currently building a mobile app for my product, the web app for it is already online where docs can be changed/updated and can be uploaded images to. I want to reflect this changes on my mobile app as soon as the user changes from one screen to the other (mostly on the main screen).

I've tried different alternatives:

Current:

On every fetch from the server delete my pouchdb records and create them again. This has proved to be the most consistent method I've done, however it is grossly inefficient, mostly because I download the images from urls & store them as blobs so the app works offline. It lags arount 3-5 seconds on a modern device.

Some other things I've tried:

Update only records that changed on the server using get and upsert. However, for example if a record was deleted on the server it stays on my pouchdb, because its not present on the api call so it's not updated.
Reply all
Reply to author
Forward
0 new messages