Open isAlmogK opened 9 years ago
Recreating the issue I'm doing the following
Open my app in online mode (groundDB is synced and is ok) Go offline (airplane mode on) Fill out a form which creates local collection (grounded) Check the data was saved locally Close the app (browser tab) *\ I believe this is causing the issue Go online (airplane mode off) Open the app again no sync that data is not uploaded Now at some point the local data is also lost
This is only happing on mobile / tablet
Tested on the following
Tested On
Android Phone / Nexus 5 / Chrome
Android Phone / S4 / Chrome
Android Phone / S5 / Chrome
iPad Mini / Chrome
I just tested this issue on the GroundDB demo - http://grounddb.meteor.com/
and the outstanding methods: (Methods waiting to be sent) are deleted or lost if you close the browser tab
The ground db demo is pretty old - is this still the case on the latest version?
Yes this still happens with the latest version, which is what I'm using in my app. Basically once you close the browser tap you lose the methods that were saved
@raix are you looking at fixing this based on this issue you really can't use GroundDB
@raix we did some heavy tests here and the answer is quite 'simple' now: Mobile browsers can't handle this. The answer is the same. if you close your chrome, you lost your local storage and your progress.
Has anyone else had this issue?
This seems to be an issue just with Chrome Mobile, we tested on Firefox mobile and it's fine
@raix I've been working with @almogdesign in this issue and I've made a lot of tests, and here are the results.
Apparently mobile chrome has a bug with local storage. I've tested not just Ground DB, but lscache and amplify with it. We have another personal package that uses local storage and it is bugged too. I've did some tests cleaning cache, removing appcache, etc. The answer remains the same. At that point we started to try Firefox Mobile, and for our surprise it worked (local storage). This was tested in 4 different devices.
But we had another issue with FF, and here it is: You go online, switch to offline mode and create a new document. If you close firefox and reopen, now online, the document will be there if you call Collection.find().fetch()
. But it will not sync (this on firefox mobile, chrome already cleared our data). At this point I don't have too much time to continue debugging, since this works in all desktop browsers. So I've created a little hack that is called on startup, it subscribes to my collection and then compare GroundDB docs (I've made this with Ground.lookup()
) with my database, inserting the new ones.
That was our solution. @almogdesign also reported the bugs to some googlers. I think that with a little effort ground db can solve this by it self.
Thanks for support.
perhaps we should add more storage adapters to the store package? - eg. use indexedDB when available or cordova stuff when available?
btw. I did create a QA app for testing gdb: https://github.com/GroundMeteor/qa - not sure if it still passes or can be useful?
bugger - I guess we should add more storage handlers then.
@raix, I think that add more storage handlers will solve this and also create a more stable backup for apps that really need this. But we should probably do some tests before choosing the one since this behavior in chrome wasn't expected. It is possible to make your localstorage package more configurable? So we can add options over time. IndexedDB seems like a nice one, but I will sure use cordova suport soon.
The Store package has a priority list - the best storage adapter at the top - so it will pick the best storage available. The storage adapters are async and if they have the same api as the localstorage adapter it should just work. The storage adapters register them selfs in the store package.
Store: https://github.com/GroundMeteor/store
Ranked storage: https://github.com/GroundMeteor/store/blob/master/client.js#L6-L8
Localstorage: https://github.com/GroundMeteor/localstorage
https://github.com/GroundMeteor/localstorage/blob/master/client.js#L112
I have tried localforage - but we need namespaced storage and events etc. (would also be nice to have a test package for storage adapters - making sure they comply with the api and works)
Hey Guys, So this is a pretty big issue in chrome and it's recent with the last couple updates M42 you can see the full thread at - https://code.google.com/p/chromium/issues/detail?id=479767
And stackoverflow at http://stackoverflow.com/questions/29876790/localstorage-not-being-persisted-in-hybrid-app-in-android-m42/
It looks like a number of developers are moving towards IndexDB but this was fixed back in May 5th in the beta version. And I think with the todays update it works fine
Any news on this issue? I still have the same problem with android app.
Login - online Subscribe - online Ground - online ( with {cleanupLocalData: false} ) Go ofline Update data - offline Close app - offline Go online Start app Login - online Subscribe - online Updated data is lost !! Everything is reverted back to server version !!
Result is same if I first subscribe then ground or first ground then subscribe. Every time it is reproducible.
@barisro never had that fixed in my app. In my case, this was a crucial issue with this and other apps. I had to workaround using local files (inside the device) and using them as cache. Using this with GB fixed all my issues.
I'm seeing that my local data is not syncing back online when I go from online to offline, it just saved locally. And sometimes it's deleted before it syncs online