marmelab / marmelab/react-admin
Nested resources with `TabbedForm` with `syncWithLocation` enabled
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 26.9k
- Forks
- 5.5k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 19
Description
Is your feature request related to a problem? Please describe.
I'd like to use nested resources with <TabbedForm> and syncWithLocation enabled. This is not possible due to TabbedFormView using splat route:
{syncWithLocation ? (
<Routes>
<Route path="/*" element={renderTabHeaders()} />
</Routes>
) : (
renderTabHeaders()
)}
The scenario is as follows: I have an edit page for a resource. It renders a TabbedForm. On this edit page I'd like to navigate to a nested resource that is declared similar to this:
<Resource name="parent" edit={EditView}>
<Route path=":id/child" element={<ChildView />} />
</Resource>
function EditView() {
return (
<Edit>
<TabbedForm>
<FormTab label="tab1" />
</TabbedForm>
</Edit>
}
Describe the solution you'd like
I'd like to be able to use nested resources and TabbedForm on a source view. This will be possible if we add some kind of prefix before splat route:
{syncWithLocation ? (
<Routes>
<Route path="/tabs/*" element={renderTabHeaders()} />
</Routes>
) : (
renderTabHeaders()
)}
Describe alternatives you've considered
Probably, as a workaround I can navigate to an intermediary view that does not have a splat route, so it doesn't catch the child view route:
navigate("/parent");
navigate("/parent/123/child");
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the TabbedFormView implementation, especially its syncWithLocation route handling, and reproduce the nested Resource scenario from the issue. Done means a TabbedForm can use syncWithLocation while navigation to a nested child resource remains reachable rather than being caught by the tab route; the issue does not name a test file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100