rt2zz / redux-persist

persist and rehydrate a redux store
MIT License
12.94k stars 866 forks source link

Correct way to use blacklist/whitelist? #1292

Closed Danondso closed 2 years ago

Danondso commented 3 years ago

Hello!

Easy question here I hope, I'm working on a react native application and I'm exploring possibilities around blacklisting parts of state. My interpretation of the documentation is that you can blacklist parts of your state tree so they won't trigger a write. My goal with this is to only trigger writes when a part of the state changes that actually matters for us and not for ephemeral data.

Is this an incorrect interpretation of it? I've read issues and stack overflow answers but I don't feel like I've come to a solid conclusion on this.

Would the correct solution to my problem be manually handling persisting the data instead?

Thanks! ~Dublin

1ak31sha commented 3 years ago

they should update the naming to 'allowList' and 'exlcudeList'

goelshobhit commented 3 years ago

const persistConfig = { key: "root", storage, whitelist: ["state_which_you_want_to_persist"], blacklist: ["state_which_you_do_not_want_to_persist"] }

const persistedReducer = persistReducer(persistConfig, createReducer);

Danondso commented 2 years ago

Tried essentially the last comment in here and it didn't work out. Since I'm no longer working on that I'm closing the issue.