vicentedealencar / redux-pouchdb

sync store state to pouchdb
223 stars 18 forks source link

Black/whitelist store keys #17

Closed jamalx31 closed 5 years ago

jamalx31 commented 6 years ago

is there a way to decide what part of each reducer will be persisted? e.g: { a: [], b[] } and only want 'a' to be synced with the DB

vicentedealencar commented 6 years ago

Maybe you could use reducer composition

const yourPersistedAReducer = persistCollectionReducer(yourAReducer)
const yourABReducer = (state, action) => {
  return {
    a: yourPersistedAReducer(state, action),
    b: yourBReducer(state, action)
  }
}

ps: this is a sideproject not battletested and open to feature sugestions as PR :)