-
-
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
[META] v3.0.0 #3611
Comments
Oops! Hit "submit" too quickly. cc @reactjs/routing, @gaearon The wishlist really is the wishlist. I'd like to get an |
BTW, "support async route leave hooks" is I think an explicit non-feature here. Users should leverage the custom confirmation prompt support in history to accomplish showing custom dialogs there. |
Regarding the history v3 upgrade, how do we want to handle that? Should we support both v2 and v3 histories? The API change around |
I'm condensing and clearing out some earlier comments: @dmitriid notes that the @umidbekkarimov mentions router.push({ ...location, query: newQuery })
router.push({ ...location, query: { ...query, ...newQuery } }) |
For history v3, I think the right way to go forward is to do something like this check: https://github.com/reactjs/react-router/blob/v2.5.2/modules/Router.js#L18-L21 The user-facing APIs are largely identical, so we'll just force the user to supply a v3 history, and throw if the history does not support |
I was going to PR something around that soon. It shouldn't be hard, just change things like this call to |
I have the feeling that async Say I have a
It would be nice if this can be addressed in v3 and if this works as intended, it would be nice if the docs could explain this behaviour. |
I don't know if it can be useful for you guys but since 3.0.0-alpha.2, the first click on a Link when the app is loaded change the URL but does not render the component associated to the new URL. After that first click, everything works fine though. I use react-router-redux, I don't know if it changes something... |
Quick update for anyone that cares – main blocker for moving to an actual RC is figuring out how to display loading status when doing async routing, as that's become a major issue for us at work. Need to figure out the appropriate API here, and I don't think we should commit to an RC until we've figured that out (would ideally like to avoid that sort of API change after we hit RC). |
@taion some thoughts about loading status: These days I prefer doing async loading in a userland On the other hand, |
Doing async loading in the component is tempting but suboptimal in the case of nested routes – it forces waterfalled loads, as we've discussed on other issues. I consider that compromise to be unacceptable. Users should not do async loading as part of the render cycle. |
Oh man, I keep forgetting about that. How awkward... |
Maybe this is an interesting point for an upgrade guide:
I'm not really sure currently what is the best way to bring back EDIT: Maybe the fastest way to get
|
I would like to have two other hooks: When entering a route, the general idea is:
The |
We're not planning on adding additional route hooks at the moment. The API surface area is too large there, and many of the existing use cases are better handled at the component level. While we don't plan on deprecating any existing route hooks in v3.x, we are unlikely to add any new ones. The set of use cases there are not broad enough to warrant the increased API surface area. |
Meanwhile history 4.0.0 has been released ;-) |
But how does it work? :( |
history 4.0 will correspond with react-router 4.0, which is being worked on separately from 3.0. This is more of an evolutionary change, whereas 4.0 will be more revolutionary (and hence history 4.0 is a very big shift). |
I'm downgrading to 2.8.0. It seems that the 4.x release isn't official. This site https://react-router-website-uxmsaeusnn.now.sh/quick-start looks kinda dodge and the API is a bit of a mess now, aparently... I supose I upgraded pre-maturely. but a -beta or -rc tag would be great. |
It's a pre-release, hence the - after the version. It's "official" in the sense that @ryanflorence released it. It has an entirely new design, so there isn't really a defined upgrade path just yet. You should give it a try on a new application, rather than trying to shoehorn it into an existing app with routing in it. |
Understood. I downgraded. Been optimistically updating a lot of things today, Not sure if I spend more time chasing bugs already fixed in more recent releases or new bugs introduced by more recent releases ;) |
I know that this is about v3 but since we're talking about v4 already anyway, is there any place where I can find the reasoning behind the changes in v4? It seems like everything has changed and it would help me (and I'm sure others) to know why. |
Yeah we'll have a write up soon. Short story is, React Router had too much API and got way too far from being a "React Router" but was rather a "Router for React". It wasn't composable, and it wasn't declarative. So we made it composable and declarative. |
On a side note, https://react-router-website-uxmsaeusnn.now.sh/ contains a dead link ("hosted on GitHub" points to https://github.com/reactjstraining/react-router). |
Just merged in |
3.0.0-beta.1 is out! https://github.com/ReactTraining/react-router/releases/tag/v3.0.0-beta.1
|
I'm not on twitter, so I'm posting here, v4 looks awesome! I read some of the examples and rationale today, and the new API makes so much sense. Reminds me how some of my own component designs have evolved as I've gotten more experienced using React. Can't wait to use v4! |
Really would love to see efforts for #2286. I am of the opinion, however, that this is a bug with react-router and we should be able to specify if an |
@jflayhart 4.0 uses path-to-regexp, which lets you do that exact kind of thing. Are we good to go on 3.0? #3852 is the only thing outstanding, and that can be done in a minor later. |
Is 3.0 still going to be released then? I kind of assumed you were going to jump straight to 4. That's not the case? |
2.x/3.x will be maintained indefinitely, for those that don't want or aren't able to upgrade to 4.0. 3.0 rolls up some deprecation removals and a few improvements/fixes, but is otherwise a fairly boring release 😄 |
That's actually great news. I know the project I'm working on is fairly large / complex and the likelihood of getting a thumbs up to go to 4.0 may well be a long time coming... So thanks 👍 😄 |
I'm not aware of any blockers. |
I'm setting this up as a meta-issue instead of a milestone to allow for more commentary and discussion. I'm going to close the originating issues and fold them into here for now, so we have a single issue on which to track things.
We're looking to cut a v3.0.0 soon, starting with PRs, to update dependencies, clean up deprecations from v2.x, and give users a path forward. I'm going to use this meta issue to list out the changes we're looking at making as we lead into release.
Requirements
These are the things that we must resolve before release:
withBasename
; given the removal of the automatic<base href>
handling, adding the basename enhancer by default doesn't accomplish muchreplace
to ensure that the initial location has akey
when using browser history? cc @mjacksonWishlist
These are the things that I'd personally like to get to before release, but am willing to discard if they cause too much schedule slip:
<LocationProvider>
component to inject downlocation
as a prop into a separate component that just handles routing state managementlocation
from the storelistenBefore
?matchRoutes
handler, instead have the router ask each route for whether it matches, and the matched routes<HapiRoute>
, to allow users to use route handlers with their choice of route matchingrouteParams
too, as each route would give its matched params (Empty routeParams cause #3549)getComponent
,getChildRoutes
, &c.) (Feature request: Promise support in getComponent #3606)System.import
match
helpers, since they don't do quite the same thing (Revisit server-side API and isolate into subdir #3290)Well, please discuss.
The idea is to avoid any major breaking API changes – a working v2.x config should work with minor changes in v3.0.0. I'd like to take the opportunity to clean up cruft, but it's intentional that the wishlist is much longer than the list of requirements – I'm not going to be heartbroken if we can't get to some of these.
The text was updated successfully, but these errors were encountered: