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

V2 #182

Closed
wants to merge 3 commits into from
Closed

V2 #182

wants to merge 3 commits into from

Conversation

mjackson
Copy link
Member

@mjackson mjackson commented Dec 8, 2015

I believe this branch contains all the modifications we need to release v2. @rackt/routing please review in case I missed something.

@mjackson
Copy link
Member Author

mjackson commented Dec 8, 2015

The only thing I'm a bit hesitant about is that we didn't warn people we were going to remove createLocation as public API, but I think that's a relatively minor change because it was only ever really used for server-side rendering.

Also, should probably update docs before merging.

@taion
Copy link
Contributor

taion commented Dec 8, 2015

What do we want to do with the match API in React Router? Currently it calls into history.createLocation: https://github.com/rackt/react-router/blob/v1.0.1/modules/match.js#L37-L39.

I'm fine with deprecating createLocation - we just need to figure out how to write that function before we proceed, though.

@timdorr
Copy link
Member

timdorr commented Dec 8, 2015

I think we should keep it. You can go from LD to string with createHref or createPath, but not back? Since we seem to prefer LDs, that seems a bit backwards.

@taion
Copy link
Contributor

taion commented Dec 8, 2015

The point of createLocation is to go from location descriptor to location, so the router can match. Maybe we should update createLocation to also take a location descriptor? I don't know how to make match work otherwise.

Maybe we should be unconditionally calling history.createLocation on the input to match.

@taion
Copy link
Contributor

taion commented Dec 8, 2015

Okay, sorry, I think we're actually not ready for 2.x yet... I totally forgot about createLocation.

I think we should update createLocation to work with match and push that out as 1.16.x. Then we'll finally have fully forward-compatible APIs, and React Router 1.1.x can depend on "history": "^1.16.0 || 2.x".

This way users will actually not be broken, and they'll have the full set of deprecations.

@mjackson
Copy link
Member Author

mjackson commented Dec 8, 2015

Users shouldn't ever actually need to use createLocation. It's private API.

Server-side match can just work like:

match(req.url, routes, ...)

That's the beautiful thing about us being able to accept either a path or an object as a "location descriptor". You can give us a plain URL if that's all you have. In a lot of ways it's actually simpler.

@timdorr
Copy link
Member

timdorr commented Dec 8, 2015

But how does match convert that string to a location descriptor? Via private API usage?

@taion
Copy link
Contributor

taion commented Dec 8, 2015

Nope, I figured out how to do it without using any private APIs, and without some of the hacks that I attempted on the way:

remix-run/react-router#2680

@taion
Copy link
Contributor

taion commented Dec 9, 2015

Per this discussion on remix-run/react-router#2680, we're still going to have to update history.createLocation to accept a location descriptor, and warn when called with multiple arguments.

We can and should drop the non-instance-bound createLocation as a public API, though - there's no reason for anyone to use that when history.createLocation is available.

@mjackson
Copy link
Member Author

mjackson commented Dec 9, 2015

@taion @timdorr I've added back the history.createLocation instance method, but no warnings about multiple arguments. At this point I'd rather just ship v2.

@taion
Copy link
Contributor

taion commented Dec 9, 2015

I can try to put together a PR for createLocation later today or maybe tomorrow. At this point, until we update React Router, nobody will be able to use history v2 anyway, so there's not much immediate benefit from releasing right now.

@mjackson
Copy link
Member Author

mjackson commented Dec 9, 2015

The only real immediate benefit to me is that I get to cross something off my TODO list.

@taion
Copy link
Contributor

taion commented Dec 9, 2015

That's a pretty good benefit (:

This sounds a little byzantine, but what do you think of releasing a 1.16.0 with the deprecation warnings removed (maybe after we fix createLocation)?

I'm a little uncomfortable that all the code we've pushed since 1.13.1 isn't getting used (even through the backward compat shims). It means that we aren't getting e.g. bug reports, so if there are problems, we won't know until (much) later.

I'm thinking something like:

  1. Fix createLocation API
  2. Release a 1.16.0 without deprecation warnings that users can upgrade to for the moment until we're done with React Router 1.1.x
  3. Release 2.0.0
  4. Release a 1.17.0 that adds back the deprecations

It sounds weird written out like this, but it means that we can start exercising the new/modified code paths, and get more confidence around the new code working, which means we have more time to fix bugs as they come up.

@mjackson
Copy link
Member Author

mjackson commented Dec 9, 2015

ok, let's do it.

@taion
Copy link
Contributor

taion commented Dec 10, 2015

👍

}

const search = searchBase + (searchBase ? '&' : '?') + queryString
const search = '?' + queryString
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 on ripping out my confusing mess here.

@timdorr
Copy link
Member

timdorr commented Dec 22, 2015

I noticed this diverged quite a bit from master. Doing a rebase now to get everything back in line.

Edit: Just because I'm paranoid, I left the old version on my fork.

Also, update createLocation signature and remove it from top-level
exports.

Closes #172
@timdorr
Copy link
Member

timdorr commented Dec 22, 2015

BTW, this looks all good to me too. :shipit:

@timdorr timdorr mentioned this pull request Dec 22, 2015
4 tasks
@mjackson
Copy link
Member Author

mjackson commented Jan 3, 2016

Instead of removing deprecated code in 2.0, we'll remove it in 3.0.

@mjackson mjackson closed this Jan 3, 2016
@mjackson mjackson deleted the v2 branch March 17, 2016 15:33
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants