redux-deep-persist
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "redux-deep-persist", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Allows to easily create a deep configuration of a whitelist or blacklist for the redux-persist module.", | ||
@@ -11,4 +11,3 @@ "author": "Piotr Kujawa <piotrkujawa.dev@gmail.com>", | ||
"src", | ||
"lib", | ||
"README.md" | ||
"lib" | ||
], | ||
@@ -15,0 +14,0 @@ "scripts": { |
# Redux Deep Persist | ||
[](https://img.shields.io/npm/v/redux-deep-persist) [](https://img.shields.io/npm/dw/redux-deep-persist) [](https://img.shields.io/github/license/PiotrKujawa/redux-deep-persist) | ||
<a href="https://dev835.d86k7pvhbipq8.amplifyapp.com" target="_blank">Demo Page</a> | ||
@@ -7,7 +10,7 @@ | ||
It contains transforms and state reconciler for [Redux Persist](https://www.npmjs.com/package/redux-persist) giving you a possibility to define a nested configuration for your redux-persist. | ||
Redux Deep Perist contains transforms and state reconciler for [Redux Persist](https://www.npmjs.com/package/redux-persist) giving you a possibility to define a nested configuration for your redux-persist. | ||
If your redux state is deeply nested you don't have to create multiple, nested persist configs. You can easily create a whitelist or a blacklist for fields at any level of your state, using simple dot notation `[someProp.secondLevel.thirdLevel.anotherLevel]` | ||
The state should be as flat as possible but sometimes is not and in that case, this will be very helpful. | ||
Redux documentation recommends to keep the state as flat as possible, but it is not always possible. Redux Deep Persist may be very helpful in a situation when deep nesting is hard to avoid. | ||
@@ -29,3 +32,3 @@ ## Installation | ||
{ | ||
root1: { | ||
property1: { | ||
a1: { | ||
@@ -43,3 +46,3 @@ b1: { | ||
}, | ||
root2: { | ||
property2: { | ||
a1: { | ||
@@ -66,5 +69,5 @@ b1: { | ||
whitelist: [ | ||
'root1.a1.b1', | ||
'root1.a2.b2.c2', | ||
'root2.a2', | ||
'property1.a1.b1', | ||
'property1.a2.b2.c2', | ||
'property2.a2', | ||
], | ||
@@ -98,6 +101,6 @@ rootReducer, // your root reducer must be also passed here | ||
* **"Duplicates of paths found in your whitelist/blacklist."** | ||
- _you defined duplicated paths in your whitelist or blacklist arrays. Wrong: ```["root1", "root2.a2", "root1"]```._ | ||
- _you defined duplicated paths in your whitelist or blacklist arrays. Wrong: ```["property1", "property2.a2", "property1"]```._ | ||
* **"Subsets of some parent keys found in your whitelist/blacklist. You must decide if you want to persist an entire path or its specific subset."** | ||
- _i.e. if you want to persist the entire "user" property you can't list its subsets in the config. Wrong: ```["root1", "root1.a1"]```_ | ||
- _i.e. if you want to persist the entire "user" property you can't list its subsets in the config. Wrong: ```["property1", "property1.a1"]```_ | ||
@@ -104,0 +107,0 @@ ### Examples repository |
87348
115