elgerlambert / redux-localstorage

Store enhancer that syncs (a subset) of your Redux store state to localstorage.
MIT License
1.32k stars 107 forks source link

Need a fallback when localStorage is not available #47

Closed bhoomit closed 8 years ago

bhoomit commented 8 years ago

There are two cases where I'm having trouble.

  1. Safari private browser
  2. Server side rendering

In both the cases local-storage is not available and it stops executing further.

How should I fix this issue?

junosuarez commented 8 years ago

you can stub it in your code with something like

import adapter from 'redux-localstorage/lib/adapters/localStorage'

const localStore = window.localStorage || {}

adapter(window.localStorage)

...
elgerlambert commented 8 years ago

Hi @bhoomit,

Should be fixed now! (1.0.0-rc5)

bhoomit commented 8 years ago

@elgerlambert thanks :) Will check.

alicewriteswrongs commented 7 years ago

I'm using 1.0.0-rc5 and seeing exceptions when localStorage is not available, is the solution above still necessary (doing some sort of stub) to handle those cases?

alicewriteswrongs commented 7 years ago

disregard my comment! ✌