alt
alt copied to clipboard
Isn't fn.assign useless inside getState?
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?