Warning
Angular version 9 is officially outdated, so this version is not supported anymore.
ng update @ngx-pwa/local-storage
Caution
Please check the following point was done successfully. Otherwise you would lost previously stored data.
Version 8 of the library fixed a legacy issue about how data was stored in indexedDb
.
To manage backward compatibility, a new IDBNoWrap
option was introduced:
true
: new and clean behaviorfalse
: old and backward-compatible behavior
In version 8, the default was false
, to avoid breaking issues.
But now the library has schematics for automatic migrations, so we can move to the clean behavior, and thus true
is now the default in version 9.
Doing ng update
should have managed backward compatibility. But it is not easy to be sure schematics work in all cases, so be sure the migration was done correctly, otherwise you would lost previously stored data.
Check the AppModule
of each project where you use this lib:
- if you started using this library in versions <= 7, you should see
StorageModale.forRoot({ IDBNoWrap: false })
, - if you started using this library in version 8 and you followed instructions at that time (ie. you already set
IDBNoWrap
totrue
or usedng add
), you should seeStorageModale.forRoot({ IDBNoWrap: true })
or noIDBNoWrap
option at all.
If ng update
did not work as expected, please delay the update and file an issue. Again, all previously stored data may be lost otherwise.
The following APIs were already deprecated in v8 and are now removed in v9. Please follow the migration guide to v8 for more details about how to update to new APIs.
- Removed providers for prefix management
- If you are concerned, be very careful with this migration, otherwise you could lost previously stored data
{ provide: LOCAL_STORAGE_PREFIX, useValue: 'myapp' }
andlocalStorageProviders()
(useStorageModule.forRoot({ LSPrefix: 'myapp_', IDBDBName: 'myapp_ngStorage' })
module import instead)LocalStorageProvidersConfig
interface (useless)
- Removed APIs in validation
JSONSchemaNumeric
interface (useJSONSchema
instead)LSGetItemOptions
interface (useless)
- Removed methods in
LocalStorage
service.size
(use.length
orStorageMap.size
instead).has()
(useStorageMap.has()
instead).keys()
(use iterativeStorageMap.keys()
instead).setItemSubscribe()
(use.setItem().subscribe()
instead).removeItemSubscribe()
(use.removeItem().subscribe()
instead).clearSubscribe()
(use.clear().subscribe()
instead)