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

DeleteButton resource is not passed down #5869

Closed
ybrodsky opened this issue Feb 4, 2021 · 1 comment · Fixed by #5884
Closed

DeleteButton resource is not passed down #5869

ybrodsky opened this issue Feb 4, 2021 · 1 comment · Fixed by #5884
Labels

Comments

@ybrodsky
Copy link

ybrodsky commented Feb 4, 2021

Is your feature request related to a problem? Please describe.
I have a resource named answers and another named questions. Within a route belonging to answers I have a list of questions displayed in a table. I want to use the DeleteButton to be able to delete a question from here. The DeleteButton accepts an attribute resource but it's only used to display the confirmation message.
When the time comes that RA does the actual delete request, it gets the resource from the context, in this case the wrong resource answers. You can see here

where the resource is no longer passed down.

Describe the solution you'd like
To be able to pass resource to the DeleteButton and that property be passed down up until here

so that you are able to manually overwrite the context resource.

Describe alternatives you've considered
I managed to resolve my problem using this:

<ResourceContextProvider value="questions">
  <DeleteButton resource="questions" />
</ResourceContextProvider>

but it took me 1 hour of digging through your code, when the instinctively solution is to simply use the resource attribute in the button and have it pass down.

@djhi
Copy link
Collaborator

djhi commented Feb 8, 2021

Hi and thanks for the report. That's a bug indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants