-
-
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
Allow passing a custom resource prop to Create / Edit #5662
Comments
Related (I think) to #5648 |
fzaninotto
added a commit
that referenced
this issue
Jan 3, 2021
fzaninotto
added a commit
that referenced
this issue
Jan 4, 2021
Hey @danjebs, were you able to find a workaround to this? I'm in the same situation. |
Unfortunately not - I ended up switching to having the forms on their own pages. I thought they allowed using drawers again but I didn't double back and re-change it since I had already converted them and it seems this isn't entirely approved of. But...I thought it would be doable since 3.11.2. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi guys, loving using React-Admin! The look on my clients' faces was priceless - "Will it actually be this fast? 🤯 "
I have a feature request for a now-deprecated feature to be re-enabled, although maybe you will have a compelling clarification of why it was removed. Apologies if this has been covered elsewhere, I couldn't find another discussion pertaining to this.
Is your feature request related to a problem? Please describe.

In prior versions of React Admin (I was using 3.7.0), I was able to make Create/Edit forms within complex objects, for simple objects within it. For example, in the image below, a Program could open a Drawer component which allowed for adding ProgramDates or FAQs related to theProgram. As a Program is a complex object with many relations within it, this prevented the user from having to switch contexts to fill out a very simple form.
This was achieved by the following:
In newer versions of React-Admin, the
resource
that I pass is overwritten by the resource in the URL and therefore the submit sends to the "wrong" endpoint.Describe the solution you'd like
The ability to override the
resource
prop in the CreateContext or EditContext. I understand there may be some issues that this causes - but I think having the option, with the caveat that some redirects etc won't work, is worthwhile. Perhaps the prop could be calleddangerouslySetResource
so that you can absolve responsibility for bugs arising from it 😅Describe alternatives you've considered
I attempted to use the useCreate and useEdit hooks, but they remove the convenience of SimpleForm and lead to a duplication of components.
Additional context
The frustrating part about this bug is that I didn't upgrade and it still affected the app - even with my dependencies locked at 3.7.0, it still broke the app when I re0built my Docker container (and re-ram
npm install
). And that's probably more of an issue with NPM, though. Luckily the app is still in QA, but a change like this that could break the an app and require a re-write of many pages makes me nervous.EDITS
Grammar, adding name for override prop, adding edits
The text was updated successfully, but these errors were encountered: