Ionic Storage is not persistent with sqlite and --prod flag


#1

Ionic Storage is not persistent with sqlite and --prod flag. If i build without --prod my storage is persistent and I get the data, but if i build with --prod the data get’s cleared EVERY reboot on iOS and Android.

I do get logs that the db is opened

OPEN database: __APM
SQLitePlugin.js:106 new transaction is waiting for open operation
SQLitePlugin.js:106 new transaction is waiting for open operation
SQLitePlugin.js:179 OPEN database: __APM - OK
SQLitePlugin.js:80 DB opened: __APM

This is how i initialize the module:

IonicStorageModule.forRoot({
  name: '__APM',
  driverOrder: ['sqlite']
}),

And this is where i initialize my app:

platform.ready().then(() => {
  statusBar.styleDefault();

  storage.ready().then(() => {
    storage.get('onboarding_shown').then(result => {
        // Onboarding is present on reboot without --prod, not present with --prod
    });
  });
});

This is pretty annoying when working with authentication and you would expect sqlite storage to always be persistent. This is on iOS and Android devices I think this behaviour started after I updated to ionic ^3.7.0 but can’t confirm it since i just refactored from 2.0.0-beta.11, has anyone else experienced similar issues?


#2

--prod shouldn’t change anything about the native parts which sqlite is part of. This is indeed very strange.

Post your ionic info output please.