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

Add more config options and tests #1

Closed jdlehman closed 9 years ago

jdlehman commented 9 years ago
elgerlambert commented 9 years ago

Hi @jdlehman, thanks for your PR!

Could you provide me with a little more context and tell me about your use-case/how you're using redux-localstorage.

I'm curious about your hydrate/dehydrate use-case. I thought about this type of functionality, but wasn't sure if there's really any need for it. If there is, I would prefer sticking to simpeler terminology such as format/parse, but why would you care or need to influence the structure of the data persisted to localStorage? Or am I mis-understanding your use-case and are you using these "hooks" for something else?

I'm also curious about your use-case for read-/writeError. I'm wondering whether simply throwing the error (allowing you to try/catch) might be better, rather then adding more config options.

jdlehman commented 9 years ago

The use case for hydrate/dehydrate is to handle Immutable data structures or data that needs to be massaged to get into a format to properly be used with JSON.stringify.

As for the errors, I think throwing the error is definitely the way to go instead of more config options. Good call

jdlehman commented 9 years ago

Removed error handing configs. Via slack discussion we decided it is probably best to throw an error to be handled elsewhere. (if we want to provide this customization)