rt2zz/redux-persist

How to blacklist a nested property that is inside of an array?

RaffayHusayn opened this issue · 2 comments

My redux store looks like this:

{
"stationsReducer":{
      "origin":"something",
      "dest":"something-else",
      "bookmarks":[
         {
            "trip":{
               "origin":"trip-something",
               "legs":[
                  {
                     "train":{
                        "train_id":"123",
                        "details":{
                           "headsign":"blah blah",
                           "polyline":"some String"
                        }
                     }
                  }
               ]
            }
         }
      ]
   }
}

Using the examples given in the redux-persist repo, I can blacklist objects that I can directly access for eg: I can blacklist the entire bookmark array. But I can't seem to blacklist something that is inside the array. I want to blacklist polyline property which is inside 2 arrays.

How can I go about doing it or is it even possible ?

Yes, it's possible :)
I didn't expect this to be needed but I added this possibility in my Redux Deep Persist package - you can use array indexes for nested configuration. I'm still waiting for this to be mentioned in the official documentation of Redux Persist but so far I have to answer issues like yours. Here are more details https://github.com/PiotrKujawa/redux-deep-persist
(Array support is mentioned here https://github.com/PiotrKujawa/redux-deep-persist#use-cases)

I have seen your package talked about before. I like how active you are. I have changed my approach for this problem. I am not blacklisting anything. I just removed it from the redux store completely.

But I really appreciate you replying back. I will keep your package in mind if the need arises. Thanks