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

Add ability to set custom routes as Resource children #8079

Merged
merged 4 commits into from
Sep 2, 2022

Conversation

hiaselhans
Copy link
Contributor

React admin makes it fast to develop admin-interfaces with react.
However, when resources get more and more functions it is a bit unhandy to pass CustomRoutes to

This PR adds children as a property of resources and makes it possible to define the whole resource with custom sub-routes in a seperate typescript module:

import ListView from "./list";
import CustomRoute from "./customroute";

const MyResource = () => {
    return {
        list: ListView,
        children: <CustomRoute/>
    }
}

@fzaninotto
Copy link
Member

Thanks! Thats an interesting feature.

As it's an enhancement, please rebase your PR against the next branch.

Also, please document that feature and add some unit tests to make sure it works.

docs/CustomRoutes.md Outdated Show resolved Hide resolved
docs/CustomRoutes.md Outdated Show resolved Hide resolved
docs/CustomRoutes.md Show resolved Hide resolved
@WiXSL WiXSL added the RFR Ready For Review label Aug 30, 2022
Copy link
Contributor

@WiXSL WiXSL left a comment

Choose a reason for hiding this comment

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

Thanks for your work!
You are still missing some test to prove that it works.

@hiaselhans
Copy link
Contributor Author

thx @WiXSL !

i fixed the comments and added a test.
In my local env 3 unrelated tests are failing. However rebasing to next will flood the changeset in this PR

@fzaninotto fzaninotto merged commit 07ae128 into marmelab:next Sep 2, 2022
@fzaninotto
Copy link
Member

Thanks!

@fzaninotto fzaninotto added this to the 4.4.0 milestone Sep 2, 2022
@fzaninotto fzaninotto changed the title [Feat] add 'children' prop to Resources Add ability to set custom routes as Resource children Sep 2, 2022
@hiaselhans
Copy link
Contributor Author

Great, thank you!

@hiaselhans hiaselhans deleted the resource_custom_routes branch September 8, 2022 14:07
Seojun-Park pushed a commit to Seojun-Park/react-admin that referenced this pull request Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants