question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IonicStorage 1.1.6 - Opening database is delayed

See original GitHub issue

Hello, 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:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mirkonasatocommented, Oct 12, 2016

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 call get 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.

0reactions
mlynchcommented, Dec 15, 2016

Fixed with #21

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found