-
-
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 future.v7_relativeSplatPath flag #11087
Conversation
This commit started with an initial revert of commit 9cfd99d
🦋 Changeset detectedLatest commit: 576be9e The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
// https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329 | ||
if (v7_relativeSplatPath) { | ||
return pathMatches.map((match, idx) => | ||
idx === matches.length - 1 ? match.pathname : match.pathnameBase |
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 the primary functional code change - when the flag is enabled we leverage pathname
on the leaf match to ensure we include the splat portion of the path
let { matches } = React.useContext(RouteContext); | ||
let { pathname: locationPathname } = useLocation(); | ||
|
||
let routePathnamesJson = JSON.stringify( | ||
getPathContributingMatches(matches).map((match) => match.pathnameBase) | ||
getResolveToMatches(matches, future.v7_relativeSplatPath) |
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.
Everywhere we used to do this pathnameBase
mapping is now done via getResolveToMatches
🤖 Hello there, We just published version Thanks! |
I first asked this question over at #11052 but got no response, so thought I'd try here. I was hit by #11052 and was just thinking about how I came to rely on this "buggy behavior". I originally used Reach Router, as recommended by the React Router team at the time (before React Router v6). I used "Embedded Routers" as per the example on this page: https://reach.tech/router/nesting. I then migrated to React Router as recommended by the team. Is my understanding correct that the Reach Router "Embedded Routers" example is now considered to have relied on buggy behavior? Just trying to understand what the future direction might be and how it might impact my app. Thanks for your time. |
Yes - the behavior was chosen partially to help support the concept of embedded routers, but did not foresee the other inconsistencies that were introduced by that choice - such that |
🤖 Hello there, We just published version Thanks! |
I see I should have specified in the route config, as is in the PR description |
Re-implement the bug fix from #10983 behind a
future.v7_relativeSplatPath
flag because we determined that a lot of folks were relying on the buggy behavior (see #11052 and #11078).Usage:
Todo: