blurymind / YarnClassic

A tool for writing interactive dialogue in games!
MIT License
518 stars 51 forks source link

increase the 5mb local storage limit to 50mb #322

Closed blurymind closed 7 months ago

blurymind commented 8 months ago

YarnEditor persists state using the web browser's localStorage api. This unfortunately imposes a 5mb limit, which doesnt scale well when you have a giant file. Your file edits are being cached there in order to prevent any loss of data when closing the tab

One idea to increase this limit ten fold (50mb) is to use the db api. A tiny library that makes this transition less painful has been suggested https://github.com/dexie/Dexie.js

One more idea is to make yarn handle running out of storage more gracefully. I suspect things like https://github.com/blurymind/YarnClassic/issues/320 are caused by that

blurymind commented 7 months ago

https://css-tricks.com/a-primer-on-the-different-types-of-browser-storage/ https://codepen.io/blurymind/pen/mdgpYBj could just use the db api without introducing a new dependency.. or consider cacheStorage/ some other mechanism.

for caching dictionaries i should probably not be using sessionStorage and instead use cache storage https://github.com/blurymind/YarnClassic/commit/608cbef5f5715581a0fccef93aabd5dcf97fa1d2

blurymind commented 7 months ago

This is now resolved via https://github.com/blurymind/YarnClassic/commit/5d3cf8ef4001748de71fe5d6c286481cb380bc83

I kept app settings in localStorage still... but the app state (file data persistence) is now kept in a database