-
-
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
Explicitly take path instead of location for match #2676
Conversation
@@ -230,7 +230,7 @@ A *router* is a [`history`](http://rackt.github.io/history) object (akin to `win | |||
There are two primary interfaces for computing a router's next [state](#routerstate): | |||
|
|||
- `history.listen` is to be used in stateful environments (such as web browsers) that need to update the UI over a period of time. This method immediately invokes its `listener` argument once and returns a function that must be called to stop listening for changes | |||
- `history.match` is a pure asynchronous function that does not update the history's internal state. This makes it ideal for server-side environments where many requests must be handled concurrently | |||
- `history.match` is a function that does not update the history's internal state. This makes it ideal for server-side environments where many requests must be handled concurrently |
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.
This is just thrown in; that function is definitely not pure async.
Gah this is probably going to have some (trivial) merge conflicts with #2674. Please merge that PR first if we want to go ahead with making an interim release for just updating history API usage. |
My confidence that this is correct is down to 75% or so. Looking at that API, and especially with the test case I have, it can take a location descriptor, so there's not necessarily a reason to change it (although we'd still need to call But I don't think there's any reason to pass anything other than a path string into match. I'd be okay either way as long as we kept the fixes to the docs for |
Looks like we're getting around to router's part of #2186 😄 (now that history has done its part) This could start getting out of hand with changing up We don't have any sort of |
|
What do we think? Is there any reason to accept anything other than a |
Yes, for |
Fair enough. Closing this for now, then. |
I updated the docs here, but not
CHANGES
because we need to comprehensively update them ahead of an interim release.createLocation
yourself to make a location object; it's almost always less buggy and easier to just pass in thepath
.history.createLocation
API to take a location descriptor (rather than a list of args). (but I don't think there's a good reason to encourage users to pass in a location descriptor here)