alt icon indicating copy to clipboard operation
alt copied to clipboard

Isn't fn.assign useless inside getState?

Open deser opened this issue 9 years ago • 0 comments

In my application I call getState so frequently that it even affects performance. I started to investigate and and came across fn.assign here:

getState(state) {
      if (Array.isArray(state)) {
        return state.slice()
      } else if (fn.isMutableObject(state)) {
        return fn.assign({}, state)
      }

      return state
}

To my mind it's absolutely useless as it does only shallow copy which means inner mutable objects will still be mutable after assigning. Seems that this code just ... slows down performance?

deser avatar Dec 13 '16 12:12 deser