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

feat(Redirect): customRoutes now accept <Redirect /> #2771

Merged
merged 7 commits into from
Jan 28, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/react-admin.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

410 changes: 410 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

8,952 changes: 8,952 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

21 changes: 8 additions & 13 deletions packages/ra-core/src/CoreAdminRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,14 @@ export class CoreAdminRouter extends Component {
<Switch>
{customRoutes
.filter(route => route.props.noLayout)
.map((route, index) => (
<Route
key={index}
exact={route.props.exact}
path={route.props.path}
render={props =>
this.renderCustomRoutesWithoutLayout(
route,
props
)
}
/>
))}
.map((route) => cloneElement(route, {
exact: true,
render: props =>
this.renderCustomRoutesWithoutLayout(
route,
props
)
}))}
<Route
path="/"
render={() =>
Expand Down
12 changes: 1 addition & 11 deletions packages/ra-core/src/RoutesWithLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,7 @@ const RoutesWithLayout = ({

return (
<Switch>
{customRoutes &&
customRoutes.map((route, index) => (
<Route
key={index}
exact={route.props.exact}
path={route.props.path}
component={route.props.component}
render={route.props.render}
children={route.props.children} // eslint-disable-line react/no-children-prop
/>
))}
{customRoutes && customRoutes.map((route) => cloneElement(route))}
{Children.map(children, child => (
<Route
key={child.props.name}
Expand Down