IonicStorage 1.1.6 - Opening database is delayed
See original GitHub issueHello, With reference to Ionic Storage - QuotaExceededError - error - #10 I have now used @ionic/Storage 1.1.6 withcordova-sqlite-storage - 1.4.8 In my platform.ready() code
I have used
storage.get('introShown').then((res) =>{
});
it gives me res = null;
The reason is database is opening delayed after my call to get.
getting data for.... env
main.js:29 DEVICE READY FIRED AFTER 697 ms
main.js:30 getting data for.... introShown
main.js:29 Ionic Storage driver: cordovaSQLiteDriver
main.js:30 setting data for.... introShown value... true
SQLitePlugin.js:175 OPEN database: _ionicstorage
SQLitePlugin.js:106 new transaction is waiting for open operation
SQLitePlugin.js:179 OPEN database: _ionicstorage - OK
SQLitePlugin.js:80 DB opened: _ionicstorage
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Ionic : first loading of my android application is abnormally slow
I found the solution, you have to put these line of code in main.ts of the application import {enableProdMode} from '@angular/core'; ...
Read more >Having trouble installing the storage plugin npm ... - Ionic Forum
When our users log in it takes 7 to 8 seconds delay in presenting the first page. Sometimes the login was quick however,...
Read more >Choosing the Right Data Storage Solution - Ionic.io
Explore Ionic data storage options: Ionic Storage, Capacitor Storage, plain SQLite storage, and Ionic's Secure Storage solution.
Read more >Preferences Capacitor Plugin API
This API will fall back to using localStorage when running as a Progressive Web App. This plugin will use UserDefaults on iOS and...
Read more >End User License Agreement | Aruba Instant On
Open Source Component Name ION Version Location / Maintainer URL
@angular/animations 6.1.10 https://github.com/angular/angular
@angular/cdk 6.4.7 https://github.com/angular/material2
@angular/common 4.4.4, 6.1.10 https://github.com/angular/angular
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
There is a race condition. Especially when using the SQLite driver it’s possible that you call
get
and you get a result from e.g. IndexedDB because the SQLite driver hasn’t been initialised yet. Then you callget
two seconds later and you get a result from SQLite.As a workaround waiting for Platform.ready before reading from Storage seems to work, but a better solution would be nice.
Fixed with #21