Quasar Framework - What is the safest way to store local persistent data (for Web, Cordova & Electron platforms)?
Asked Answered
R

1

7

What is the safest way to store data offline, assuming that I want to cover all platforms (Web, Electron & Cordova).

The reason I ask is, my app Fudget (which is a Cordova / Electron - but not Quasar) uses WebSQL to store the user's app data locally. This has worked ok for years (I occasionally had an Android user whose data would be wiped by the Android OS - but not often).

But in the last couple of days, 100's of Android users are having their WebSQL (and local storage) removed (does anybody know why?), so I'm getting a lot of angry emails from people who've lost all their data and settings.

I'm currently working on Fudget 2 (using Quasar) and want to make sure this doesn't happen again. I want to cover all the platforms (Web, Mac, Windows, iOS, Android) and want to store the data in JavaScript objects locally, so what is the safest way to store this data locally for all of these platforms?

Obviously it seems that Local Storage and WebSQL (which is now deprecated anyway) are not safe. But can I used IndexedDB safely, for example? Will this persist forever?

Or do I need to integrate some proper native data storage for each of the platforms (for example, using the cordova-plugin-nativestorage plugin for Cordova, and something similar for Electron)? And if this is the case, what do I do about the Web platform?

Riyadh answered 15/12, 2019 at 13:7 Comment(4)
I'm just wondering if you ever figured out the answer to your own question. I took your Udemy course, and it helped me a lot (thanks!), although I still have a lot to learn. I'm trying to solve the local db issue also. The app I'm trying to write needs a reliable local db for substantial offline use that can sync automatically with my server (MariaDB) via a json middleware page done in PHP that I have set up. The hardest part for me so far is connecting in Quasar to something reliable. Did you find anything? – Cristobalcristobalite
I'm probably going to use indexedDB, seems pretty solid. It's really easy to use with the localforage package. If I really need persistence then I might consider using native storage (e.g. using cordova-plugin-nativestorage). πŸ‘ – Riyadh
Hello danny. I'm using quasar because of you kk. Any updates on this topic? – Crave
@Mithsew I've actually decided not to store any critical data locally. I'll only be storing preferences, email addresses, user interface flags etc locally. But all the users' core data will only be on Firebase. There are a few reasons for this: (1) reason stated above (local data deleted sometimes), (2) in case I need to change the webview. On iOS, I'm no longer able to submit updates for the original version of Fudget, because the old webview UIWebview is now deprecated & I can't change it because then users would lose their critical data (3) a bunch of complications related to subscriptions – Riyadh
C
4

I am not sure if we can count on indexeddb to last forever, but I checked the W3C Recommendation for Indexed Database API 2.0 and it seems to be thriving. The editors are from Google and Microsoft, which is a good sign (except from the viewpoint of those who don't like the influence of the Big Four in the open source world).

Also, while the GitHub issues repo doesn't get a lot of activity, it does seem to be up-to-date with posted issues getting multiple input. I was also impressed that more of the issues were feature requests rather than bug reports or requests for help.

So while we can't be sure how long it will be around, at least in the short-term the prospects look good.

It's also very well supported in all modern browsers except Opera. See: https://caniuse.com/#feat=indexeddb

Cristobalcristobalite answered 5/2, 2020 at 4:4 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.