Redux-persist: Questions about merge levels

Created on 17 Jan 2018  路  3Comments  路  Source: rt2zz/redux-persist

@rt2zz I played around with using merge levels 1 and 2 with both nested and non-nested reducers. I didn't see any problems with using autoMergeLevel2 in all cases.

  1. Is there a common scenario where autoMergeLevel2 would mess something up?
  2. Why not have autoMergeLevel2 as the default merge level for the PersistReducer?

Most helpful comment

Can we also have autoMergeLevel3?

All 3 comments

I think you are correct, and I think we will make level2 the default (although that is breaking and will require v6.

The only requirement before we make that switch is we need to tests to ensure that things behave as expected when substate is: a primitive, null, undefined, or non-plain object.

Can we also have autoMergeLevel3?

yes theoretically we could create level 3+, or even deepMerge although I am not sure in what usage that would be useful?

If anyone has suggestions for a better api to expose this I am all ears. It would be nice to do something like

let persistorConfig = {
  mergeLevel: 2
}

but then we lose the ability for tree shaking to reduce bundle size by avoiding inclusion of unnecessary reconciler code.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

umairfarooq44 picture umairfarooq44  路  3Comments

scic picture scic  路  3Comments

admbtlr picture admbtlr  路  3Comments

ucarion picture ucarion  路  4Comments

ejbp picture ejbp  路  3Comments