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
I would be accessing and editing it rather often
define large
over 100k lines with indents and tabs
hm, that sounds like a prime candidate to read into a database you can query instead of just sticking it in a javascript variable
not that kind of data
I doubt this would be an easy thing to database 😄
hmm, you could try something like mongo, but honestly your best bet is to just test it
fair enough
neither storage method was really designed to hold 100kb of JSON, so 🤷 on which works better
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