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

Slow when action contains a Event object #29

Closed
jackielii opened this issue Aug 31, 2017 · 1 comment
Closed

Slow when action contains a Event object #29

jackielii opened this issue Aug 31, 2017 · 1 comment

Comments

@jackielii
Copy link
Contributor

jackielii commented Aug 31, 2017

The cause of the problem is at:

The problem:
In react there is this bit of code:
onClick={this.props.goBack}
When the user click on this button, it calls react-router-redux's goBack action

In React router redux middleware:

function goBack(...args) {
  return {
    ...
    payload: { method: 'goBack', args }
  }
}

The following happened:

  1. user click on the button
  2. goBack fired with arguments of ReactProxy, and ReactEvent
  3. react-router-redux returns an action with payload of the above arguments
  4. redux-immutable-state-invariant stringify the whole react proxy and event tree.

It takes over a minute for that stringify to finish

Arguably the component author should've written:
onClick={() => this.props.goBack()}
However this is not a good practice of having another level of function just to work around the problem

If I understand correctly, the stringify here is only for displaying an error message? I reckon it should not try so hard to strigify everything.

leoasis added a commit that referenced this issue Sep 26, 2017
only stringify action when wasMutated. fix #29
@jackielii
Copy link
Contributor Author

Thanks! Looking forward to a release.

Regards,

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