andsala / svelte-persistent-store

Persist your svelte store in localStorage or sessionStorage
MIT License
86 stars 6 forks source link

SSR compatibility broken #9

Closed jonadeline closed 3 years ago

jonadeline commented 4 years ago

Hi,

Since the release of 0.1.4 it seems that this component is not compatible with SSR/Universal rendering (with sapper) any longer. A reference to window.localStorage is generated in the server.js causing an error as the window object doesn't exist server side.

Rolling back to 0.1.3 fix the issue.

edjw commented 4 years ago

I had the same issue with 0.1.4 and installing 0.1.3 instead also fixed the issue

mochi-co commented 3 years ago

I also have this issue, downgrading to 0.1.3 resolves the issue.

SillyFreak commented 3 years ago

The problem is very obviously here in src/local.ts and src/session.ts. @andsala would you appreciate a PR reverting the relevant changes, or was that change intentional but the build pipeline didn't do whatever it was intended to do?

andsala commented 3 years ago

I'm not using much Svelte lately so I'd love PRs to fix the issues