Open Taxel opened 7 years ago
@raix do you have any suggestions on how to resolve this issue or go about debugging it?
try removing ground db from the equation and see if you can get things running - then ground the data afterwards.
Hello @raix, we have inspected your great code and found same behavior using Mantrajs.
As far as we could find, Meteor is removing all data from collections if it is not used (or seems like that).
Then ground DB remove also all local data in this code on function observeSource:
'removed': doc => { if (!this.lastUpdatedAt) { console.log('Removiendo: ', doc); if (this !== source) { this.setDocument(doc, true); } this.saveDocument(doc, true); } }
So, on my side we think there should be some way to detect when collection is cleared and then DO NOT remove documents from local storage (IndexedDB in our case).
¿Do you know if such a thing exists?
Thanks in advance.
you could stop the ground db observe when the subscription / data is loaded
But if we stop observer, the collection will not be in sync with server anymore.
For now, we are testing to use https://github.com/ccorcos/meteor-subs-cache in conjunction with GroundDB II. So collections will not expire and data maintained in Minimongo. Let me see how it works.
As far as we have tested, I can confirm that it works correctly in our use case (about 30 grounded collections) when using https://github.com/ccorcos/meteor-subs-cache and setting expireAfter to -1.
Then GroundDB does not erase local data (IndexedDB in our case) since collections are not stopped anymore.
@raix Do you have any update on this? When I use Ground DB, My data gets cleared and I am getting empty collections. Although after removing Ground DB, Its working fine. Seems to be issue of an Ground DB.
Hi @raix , I am having a big problem with ground db. First, I used the atmosphere version (0.3.15?), now I updated to ground:db 2.0.0-rc.6, hoping this would fix my problem.
I am using Meteor React and this is the code for the main container, which is supposed to block other pages from loading before the offline database has been populated (later I will add a check if the Ground DB has already been loaded at an earlier session)
This code is supposed to subscribe to "localization" if it hasn't been loaded already. The Localization Collection is implemented as follows, the find() and findOne() method has been overwritten to call find() for the grounded DB:
This however produces the following output:
Looks fine, right? Unfortunately, the createContainer() function is called once more immediately after that, resulting in
which as I understand it means, the Ground DB was emptied without me doing it.
Please help me to fix this. Thanks in advance