3 ms·
It's good to to see IndexDB used for data persistence to reduce the need for a backend API and network calls. It's an under-used technology that's available in
by onion2k 6y ago
It's good to to see IndexDB used for data persistence to reduce the need for a backend API and network calls. It's an under-used technology that's available in every browser (https://caniuse.com/indexeddb https://caniuse.com/indexeddb).
I can recommend Dexie (https://dexie.org/ https://dexie.org/) as a wrapper to make it a bit nicer to work with.
- swyx 6y agowhat makes this application better suited to IndexedDB over localstorage? its not a lot of data. (genuine qtn, i tend to use localstorage a lot and have never handcoded IDB usage but have of course used libraries that used IDB)
- onion2k 6y agowhat makes this application better suited to IndexedDB over localstorage? its not a lot of data. I haven't found IndexedDB helps much the quantity of data (you can store more than localStorage, but most apps don't need close to that much). The advantage comes from iterating over the data (with cursors) for searching, and the fact that Indexeddb is versioned so you can migrate existing data to a new format when you deploy updates really easily.
- swyx 6y agoah, good, nuanced, points, thank you