Is storing large objects inside svelte store a bad idea?

I have a large object, would it make more sense to store it in svelte store or since its large in the app.svelte variable instead
10 Replies
MartynasXS
MartynasXSOP•2y ago
I would be accessing and editing it rather often
Jochem
Jochem•2y ago
define large
MartynasXS
MartynasXSOP•2y ago
over 100k lines with indents and tabs
Jochem
Jochem•2y ago
hm, that sounds like a prime candidate to read into a database you can query instead of just sticking it in a javascript variable
MartynasXS
MartynasXSOP•2y ago
not that kind of data
MartynasXS
MartynasXSOP•2y ago
I doubt this would be an easy thing to database 😄
Jochem
Jochem•2y ago
hmm, you could try something like mongo, but honestly your best bet is to just test it
MartynasXS
MartynasXSOP•2y ago
fair enough
Jochem
Jochem•2y ago
neither storage method was really designed to hold 100kb of JSON, so 🤷 on which works better
b1mind
b1mind•2y ago
A Store is for global vars to use/reuse across components. If you just need to access that .json and it never changes? just fetch/import it and use it. Stores can be use for persist data with local storage or indexDB too. But like Jochem is saying if you have a shema and that data will be updated and reused its best to use an actual DB subabase, or pocketbase are popular pairing these days it seems
Want results from more Discord servers?
Add your server