Meteor-Community-Packages / Meteor-Community-Packages/ground-db
Don't use localstorage when size is higher than the limit
- Dominant language
- JavaScript
- Stars
- 569
- Forks
- 77
- PR merge metrics
- No merged PRs in 30d
Description
By accident I just sended 17000 records to a client. The JSON is 7800000 characters long. Without Ground DB Meteor manages to load this huge amount (I know it's crazy!), but when I mounted Ground DB the app suddenly freezed and I couldn't even close the tab.
By using https://arty.name/localstorage.html test, I discovered the limit on my browser (chrome 39.0.2171.65 (64-bit)) is at 5200000. If by any case someone gets over that limit, the browser just collapses and you can't do anything.
So, ground db should check the size limit of the browser and throw an error or switch back to Meteor's collections if the storage size is near the limit.
Another solution could be to implement Indexed DB or Sqlite for extreme cases where you need to store more than 5MB of data? (which seems to be the limit between browsers)
Contributor guide
Research direction
No files, tests, or entry points are named. Start by reproducing the reported failure with a JSON payload near the browser's localStorage limit, then trace how GroundDB handles storage size and decide whether the completed behavior should reject the write or fall back to Meteor collections, with the issue's Chrome limit scenario covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- database
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100