joshnuss / svelte-persisted-store

A Svelte store that persists to localStorage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Initializing persisted with default value empty string nondescript syntax error

langsys opened this issue · comments

Problem

Cannot set default value to empty string, stores it as 'undefined' which triggers syntax error cannot parse undefined as JSON

REPL

https://svelte.dev/repl/472123b270dd4d7cabb82861b584a920?version=4.0.5

Hi @langsys,

I am not able to reproduce the issue. Empty string seems to work fine.

I copied your code to sveltelab (since localStorage is not supported in Svelte's REPL), and I see no error:
https://www.sveltelab.dev/9ve78945br74gpa

Closing the issue for now, but feel free to add more information and I'll re-open it.