Announcing Ionic Storage v3

Originally published at: Announcing Ionic Storage v3 - Ionic Blog

Photo by Lucas van Oort on Unsplash Today I’m thrilled to announce the release of Ionic Storage v3, an open-source library that offers an easy way to store simple data in Ionic apps. Ionic Storage is useful for building single code-base apps on iOS, Android, and the Web, while automatically using the best storage engine…

2 Likes

Hi

Thx for this and last week migrated fairly flawlessly.

The key design decision (angular) was the exact location to do the create knowing that multiple locations use storage

I opted for OnInit in app.component.ts.

Doing instead in a provider at root level would require me to mirror get and set, which seems to me a bit too much

Rgdz

Tom

1 Like

How did you initialize the storage in app.component.ts?

What I have done:

async ngOnInit() {
    await this.storage.create();
  }

but I am facing the following error:
ERROR Error: Uncaught (in promise): Error: Database not created. Must call create() first
assertDb

Also did you define the drivers? If so how?
I did the following:

await this.storage.defineDriver(localStorage);

I am facing the following error:
ERROR Error: Uncaught (in promise): Error: Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver

Please help understand what I may have done wrong and how to fix the issues

Hi

in app.compontent.ts in constructor:

this.storage.create()

And in app.module.ts

    IonicStorageModule.forRoot({
      name: 'myname',
      driverOrder: [Drivers.IndexedDB] // , Drivers.LocalStorage
    }),

Can’t say where you go wrong. For starters, defineDriver needs to go before create.

1 Like

I did so on both files.

I managed to solve it after uninstalling and reinstalling it. I dont know why but it is working now

1 Like

After upgrading from v2 to v3 storage-angular, I lost all previously saved storage. I have no special configuration for drivers(although I am using the sql-lite storage for saving transactional data). Could you please let me know if this is expected behaviour or I am doing something wrong?

Thanks
Md Najmul Hoda

Hello,

Do you know what is the max size when using indexedDb ?

i’m using @ionic/storage-angular and when checking under Application in Chrome DevTools, i’m under the QuotaExceededError. So, i’m happy :wink:

Nevertheless, something strange happened. The indexedDb never decrease, even if the size of properties decrease.

The only way is to “clear site data”.

Thanks,

capacitor 3.0 storage plugin give error on device
ERROR Error: Uncaught (in promise): Error: “Storage” plugin is not implemented on android
i follow this official doc.