square / svelte-store

528 stars 36 forks source link

Can persisted stores be configured to not sync using JSON #55

Closed sureshjoshi closed 1 year ago

sureshjoshi commented 1 year ago

Maybe a weird workflow here, but I persist a handful of strings to my local storage. Just vanilla strings.

When I reload my page, the persisted store appears to try to serialize/deserialize to/from JSON (which is stated in the docs), but it leads to this after 3 reloads

current:locale = "\"\\\"\\\\\\\"fr\\\\\\\"\\\"\""

I was just wondering if there was any way (or if it's simple enough), to set the JSON part of the serialization as an optional thing, and otherwise just read/persist flat strings.

sureshjoshi commented 1 year ago

I re-factored a bunch of my code, and this is no longer an issue. I'm going to assume I was using this incorrectly in my first pass, as I can't repro this issue.