-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Add passing custom histories to match #2813
Conversation
invariant( | ||
location, | ||
'match needs a location' | ||
) | ||
|
||
let history = createMemoryHistory(options) | ||
history = history ? history : createMemoryHistory(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.
My brain is slow. Certainly there's a better way to do this?
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.
You can't do this in the assignment because you need options
. Just history || createMemoryHistory(options)
is the best I can think of.
Can you elaborate a bit on what this is for? |
If you want to customize the history used in |
How does that come up? By assumption if you're running this on the browser, the matching has already completed on the server side, so the client-side match should be a no-op, no? |
Seems fine to me, we take whatever history you give us in |
@taion In the case of Redux, you will be passing along your state to the browser to let it continue from where the server left off. So, if you don't have history synced up to redux before you start matching, you will likely be missing some important state from the routing when crossing that divide. |
@ryanflorence Cool. I'll merge this in. This just keeps the API surface area sane between the two entry points. |
Add passing custom histories to match
Oh, that's cool, makes sense. Thanks. |
Will make redux-simple-router integration more clear.