react-router
react-router copied to clipboard
fix: support basename and relative routing in loader/action redirects
Builds on top of original PR (#9418) to handle basename
in loader/action redirects and also adds support for relative routing in redirects.
Basename example:
let router = createBrowserRouter([{
path: '/',
loader() {
// This will now properly redirect the browser to /base/other
return redirect('/other');
},
}], { basename: '/base'}
Relative routing example:
let router = createBrowserRouter([{
path: '/',
children: [{
path: 'parent',
children: [{
path: 'child',
loader() {
// This will now properly redirect the browser to /parent
return redirect('..');
},
}],
}]
}]);
Closes #9417
Co-authored-by: Mikaël ANZANO [email protected]
🦋 Changeset detected
Latest commit: d00e5bc3510b97413c81fdb263934ff02bd529e1
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 5 packages
Name | Type |
---|---|
@remix-run/router | Patch |
react-router | Patch |
react-router-dom | Patch |
react-router-dom-v5-compat | Patch |
react-router-native | Patch |
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
LGTM 👍
Hi, it seems like useFetcher load method still does not respect basename.
@cantti Can you open a new issue for that? 🙏🏼
@machour sure, done.