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

Extraenous setPath() calls on RouterMixin.componentWillReceiveProps #177

Closed
STRML opened this issue Jul 12, 2016 · 0 comments
Closed

Extraenous setPath() calls on RouterMixin.componentWillReceiveProps #177

STRML opened this issue Jul 12, 2016 · 0 comments

Comments

@STRML
Copy link
Owner

STRML commented Jul 12, 2016

If your router is in the main app's path, and that app rerenders on a path change (not uncommon), even if that path isn't passed to the router, it will rerender which causes it to send a path from the environment.

It should be safe to only listen to explicit path changes:

  componentWillReceiveProps: function(nextProps) {
    if (nextProps.path !== this.props.path) {
      var nextState = this.getRouterState(nextProps);
      this.delegateSetRoutingState(nextState);
    }
  },

To be safe we could do a shallow compare.

@STRML STRML closed this as completed in a2a9e37 Jul 12, 2016
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