ngxs-labs / async-storage-plugin

⏱ WIP: Async Storage Plugin
MIT License
34 stars 12 forks source link

Ionic App Crashed when saving large array #153

Open xsoul opened 4 years ago

xsoul commented 4 years ago

I'm using this plugin in my ionic 4 project, my app will crash when trying to save large array (500++ elements) to ngxs state with async-storage-plugin (use ionic storage plugin example given). When i'm using the @ngxs-labs/storage-plugin which internally using localStorage and sessionStorage, the app is working fine without problem.

Any help will be highly appreciate. Thank you. Error-snapshot

marcjulian commented 4 years ago

@xsoul can you provide a reproduction repository?

xsoul commented 4 years ago

Sorry for late reply. May you kindly give me some guideline what kind of repository I should prepare? Thank you

splincode commented 4 years ago

Simple reproduce where we can confirm your behaviour

xsoul commented 4 years ago

I don't have the large json file, but I manage to make it work with Indexeddb, the Sqlite will crashed during the serialization in localForage._setItem method, the code below causing my entire vs code debugger freeze and then crash the app. No error found so I can't provide any detail error message. dbInfo.serializer.serialize(value, function (value, error)

Another problem is, both indexeddb and sqlite will not persist the data, the data will being clean up after reboot application (android), I can see from Chrome devtools that the indexeddb is perfectly fill up with data, but after reboot app, the data will clean up.

The app work perfectly with ngxs storage plugin with localstorage (but can't support large amount of data)