Skip to content

Conversation

MeiKatz
Copy link
Contributor

@MeiKatz MeiKatz commented Jun 24, 2019

Actually this is nearly the same push request as #6618, that I f**ked up while updating with the changes that occurred in the time in between. So it know also supports arrays for path in <Route />. Hopefully this is now merged and we don't have to wait for this feature until RR v6.

@MeiKatz
Copy link
Contributor Author

MeiKatz commented Jun 24, 2019

@StringEpsilon

// but without escaping of slashes and dots
const escapedPath =
path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
path && path.replace(/([+*?=^!:${}()[\]|\\])/g, "\\$1");
Copy link
Contributor Author

@MeiKatz MeiKatz Jun 25, 2019

Choose a reason for hiding this comment

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

This works because responding to the regex pattern below, slashes don't need to be escaped and dots need to be wrapped by parentheses to be recognized as placeholders in the path. Given that, that we escape parentheses, there is no case that dots could be ever recognized as placeholders:
/(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?/
(see: https://github.com/pillarjs/path-to-regexp/blob/d1ec03afb6eefe7ad19e4d990a428e6b545fb3a6/index.js#L29)

@MeiKatz
Copy link
Contributor Author

MeiKatz commented Jun 25, 2019

@StringEpsilon, @timdorr It would be great if you could approve this pull request before it is outdated again. There are no breaking changes that break the backward compatibility.

MeiKatz added 3 commits June 27, 2019 19:28
instead of complete parent match, just use the url of the parent match
missed to change matchRoutes() after change in previous commit
@MeiKatz
Copy link
Contributor Author

MeiKatz commented Aug 19, 2019

Ping! So the last reaction on this pull request was now nearly two months ago and there was never a real discussion about adding it or not. So how's your latest opinion about it, @StringEpsilon and @timdorr? This PR does not change the api a lot, does not create any backwards compatibility issues and does not add any new functions or something like this. I mean, it just adds a feature many users waiting for years.

@mjackson
Copy link
Member

mjackson commented Oct 1, 2019

Won't this break existing code where people are already doing the nesting manually using the parent route's match.path?

@MeiKatz
Copy link
Contributor Author

MeiKatz commented Oct 1, 2019

@mjackson No, because it also handles absolute paths – and that's what you achieve when you build a route with match.path.

@stale
Copy link

stale bot commented Dec 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale label Dec 20, 2019
@stale stale bot closed this Dec 27, 2019
@MeiKatz
Copy link
Contributor Author

MeiKatz commented Dec 27, 2019

@timdorr Could you please remove the stale label? I don't think that this pull request will every be merged but I think it should be on the to-do list for v6.

@timdorr timdorr reopened this Dec 27, 2019
@stale stale bot removed the stale label Dec 27, 2019
@timdorr
Copy link
Member

timdorr commented Dec 27, 2019

I'm going to look into an exclusion filter so stalebot will ignore things we mark as not stale explicitly.

@timdorr timdorr added the fresh label Dec 27, 2019
@MeiKatz
Copy link
Contributor Author

MeiKatz commented Dec 27, 2019

@timdorr thank you.

@MeiKatz MeiKatz force-pushed the support-for-relative-paths branch 2 times, most recently from 712fd7c to 89d5aad Compare December 29, 2019 16:25
@MeiKatz
Copy link
Contributor Author

MeiKatz commented Dec 29, 2019

I adjusted my pull request to the changes that happened in the meantime so it is ready for 2020, RRv6 and hopefully a merge in foreseeable time.

@MeiKatz
Copy link
Contributor Author

MeiKatz commented Jan 2, 2020

@timdorr could you please check what is going on with Travis? There seems to be a test that is only queued, but if I take a look on the Travis site all checks are finished and have passed. Most likely a sync problem between GitHub and Travis.

@timdorr
Copy link
Member

timdorr commented Jan 3, 2020

I just tried restarting it. But as long as one of them works, that's OK.

@mjackson
Copy link
Member

mjackson commented Feb 4, 2020

I'm hesitant to merge this into v5 because, although it works, we cannot also introduce support for relative links w/out introducing breaking changes. So we'll have relative routes, but not relative links.

I'm kinda on the fence though because it should help smooth the upgrade path to v6 if people can replace all their <Route path={`${match.path}/foo`}/> code with <Route path="foo" /> while still on v5. So I could probably be convinced.

@ryanflorence
Copy link
Member

Thanks for everybody's work on this. I'm closing issues that are old, if they are still problems please open a new issue and reference this one. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants