Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isn't fn.assign useless inside getState? #703

Open
deser opened this issue Dec 13, 2016 · 0 comments
Open

Isn't fn.assign useless inside getState? #703

deser opened this issue Dec 13, 2016 · 0 comments

Comments

@deser
Copy link

deser commented Dec 13, 2016

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant