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

Issues with navigating across "top level" routes in contextual router #12

Closed
gurdasnijor opened this issue Mar 11, 2014 · 2 comments
Closed

Comments

@gurdasnijor
Copy link

This issue can be repro'd as follows:

Create the 'top level router' component :

<Locations path={this.props.path} >
    <Location path="/test/*" handler={testContextRouter} />
    <Location path="/testothercontext/*" handler={testOtherContextRouter} />
</Locations>

'testContextRouter'

 <Locations contextual>
      <Location path="/" handler={function(props) { return React.DOM.div(null, 'test/ROOT') }} />
      <Location path="/:slug" handler={function(props) { return React.DOM.div(null, 'test/' + props.slug) }} />
</Locations>

'testOtherContextRouter'

 <Locations contextual>
      <Location path="/" handler={function(props) { return React.DOM.div(null, 'testothercontext/ROOT') }} />
      <Location path="/:slug" handler={function(props) { return React.DOM.div(null, 'testothercontext/' + props.slug) }} />
</Locations>

Now when navigating from, say /test/etc to /testothercontext/etc2 you'll find that the url seems to update without actually activating any handlers (after the initial route transition between them works)

Edit: Thinking through it some more; the navigation from /test/etc to /testothercontext/etc2 is being done by Link components rendered at the same level as the 'top level' router. Can the issue have something to do with that?

@andreypopp
Copy link
Collaborator

I've published 0.10.1, and now your case works for me. Can you confirm?

The bug was with incorrect unregistration of routers from environment — at some point non of the routers were registered at the environment and so no changes were propagated to them.

@gurdasnijor
Copy link
Author

That fixed it; I was just about to submit a PR to update the Environment.unregister() after I tracked it down, but you're too fast! Thanks again!

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

2 participants