-
-
Notifications
You must be signed in to change notification settings - Fork 5.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
feat(Redirect): customRoutes now accept <Redirect /> #2771
Conversation
This work fine, this is how we deal with this in our code base:
To deal with I am not familiar with the testing of the router, but testing if the redirect work is like testing the Perhaps check if the |
Can't we clone the routes given by the developer instead of creating new ones and passing the developer's props to them? |
Do you mean this: customRoutes.filter(route => route.props.noLayout)
.map((route, index) => route.props.path ? (
<Route
key={index}
exact={route.props.exact}
path={route.props.path}
render={props =>
this.renderCustomRoutesWithoutLayout(
route,
props
)
}
/>
) : cloneElement(route, route.props)) I was asking myself the same question for the What makes you prefer one on another (for each case)? We could spread the user |
No, I mean don't even bother to test for the |
Sure, that's sounds better. In this case, do you want to :
In case we do (2), should we remove it for I've updated the PR with those change:
{customRoutes
.filter(route => route.props.noLayout)
.map((route) => cloneElement(route, {
...route.props ,
exact: true,
render: props =>
this.renderCustomRoutesWithoutLayout(
route,
props
)
}))}
// instead of
// {customRoutes &&
// customRoutes.map((route) => cloneElement(route, route.props))}
// just
{customRoutes}
|
…thLayout not rendering customRoutes as an array
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.
The .idea
directory and the package-lock.json
are still present. Can you remove them?
Sorry, I just did it again. I had an issue when doing it the first time: Would it be possible to run and add in this commit:
There's two options, either react-admin is a framework, or it is an application if it's a framework, it makes sense to not have a lock file as this is for an application. |
React-admin is a library, but that's not what motivates us to add a lock file. It's the fact that dependency management is permissive in JS, and a lock file is the only guarantee we have that something that worked yesterday still works today. Also, this discussion has nothing to see with your original PR, so if you want to continue it, I suggest you open a new RFC issue. |
Thanks! |
@fzaninotto thanks to you too for accepting this feature. |
Fix #2767