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

Use history.createLocation for converting location descriptors to locations #2859

Closed
taion opened this issue Jan 6, 2016 · 6 comments
Closed
Labels
Milestone

Comments

@taion
Copy link
Contributor

taion commented Jan 6, 2016

transitionManager.isActive:
This logic is wrong and should go through history.createLocation: https://github.com/rackt/react-router/blob/3494ed3974020b42c9af9490d681877829f3e9e1/modules/createTransitionManager.js#L37-L39

match:
Should be using history.createLocation in all cases: https://github.com/rackt/react-router/blob/3494ed3974020b42c9af9490d681877829f3e9e1/modules/match.js#L30-L31

Blocked on remix-run/history#200.

@taion taion added the bug label Jan 6, 2016
@taion taion changed the title Use history.createLocation in transitionManager.isActive Use history.createLocation for converting location descriptors to locations Jan 7, 2016
@taion
Copy link
Contributor Author

taion commented Jan 7, 2016

match is handling this wrong too – updated the OP.

@taion
Copy link
Contributor Author

taion commented Jan 13, 2016

Huh, the naive isActive fix will actually break #2386. Need to think about this a bit.

@seoyoochan
Copy link

I just followed ^2.0.0-rc upgrade guide documentation, using "history": "^2.0.0-rc2" and "react-router": "^1.0.3".
However, I get this error,
Uncaught TypeError: Cannot read property 'query' of undefined

My code looks like this..

function requireAuth(nextState, replace) {
  const isLoggedIn = store.getState().auth.isLoggedIn;
  if (isLoggedIn) {
    console.log('Verified User.');
  } else {
    replace('/login');
  }
}

const routes = (
  <Provider store={store}>
    <Router history={browserHistory}>
      <Route path='/' component={App} onEnter={requireAuth}>
        <IndexRoute component={Dashboard}/>
        <Route path='login' component={Login}/>
      </Route>
    </Router>
  </Provider>
);

Is this a bug? how can I solve this?

@taion
Copy link
Contributor Author

taion commented Jan 14, 2016

See #2897.

@seoyoochan
Copy link

@taion thanks for the answer, but i get this infinite redirection error, Uncaught RangeError: Maximum call stack size exceeded though. is there any workaround for this?

Never mind! It was my problem, I had to move onEnter hook to IndexRoute!

@taion
Copy link
Contributor Author

taion commented Jan 22, 2016

Closing this to track #2910 instead.

@taion taion closed this as completed Jan 22, 2016
@lock lock bot locked as resolved and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants