-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Make match
set the location as history entry when creating new memory history object
#3394
Conversation
…ry history object I believe, this is a proper fix for denvned/isomorphic-relay-router#26.
@@ -20,7 +20,7 @@ function match({ history, routes, location, ...options }, callback) { | |||
'match needs a history or a location' | |||
) | |||
|
|||
history = history ? history : createMemoryHistory(options) | |||
history = history || createMemoryHistory({ entrires: [location], ...options }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo in entries
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thanks!
This was previously rejected as #3089. We explicitly don't want to set the history location here – the history should be treated as a stateless (and potentially reusable) object that otherwise holds no state. |
@taion, But this PR code does not change state of the history, it only provides the location to |
I'm with @denvned here. The history isn't stateless by default and that is causing issues for people that assume the defaults are consistent (they are not). |
Can you clarify how this is coming up? I don't think user code on the SSR path should be touching the |
It's not directly. It's touching match({ routes, location: '/test' }, function (error, redirectLocation, renderProps) {
renderProps.router.listen(loc => expect(loc.pathname).toEqual('/test')) // Fails. This equals '/'
}) |
I think that, when rendering on the server, you should not be able to call |
I believe, this is a proper fix for denvned/isomorphic-relay-router#26.