Closed wrobson-lllow closed 1 month ago
@wrobson-lllow could you throw together a simple reproduction so we can drop in some code to replicate? Will make looking into it a lot easier.
@wrobson-lllow could you throw together a simple reproduction so we can drop in some code to replicate? Will make looking into it a lot easier.
Sure thing. Is there a simple starter repo anywhere that I can use?
Never mind found it.
@JarrodMFlesch reproduction branch custom-API-error-list-view-bug
One thing I've noticed and wondered about before, is there a reason the beforeDelete hook doesn't include 'doc' in the args object?
To reproduce, delete a record from the posts collection. If this is done from the 'record view' a toast error with the message "You must select the delete checkbox before deleting this post" will be displayed. If this is done from the 'list view' the toast error will display "Unable to delete n out of n posts"
Coming out with a fix for both v2 and v3. In v3 it will look a bit like this and in v2 it will just be appended to the end of the error.
This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.
Link to reproduction
No response
Describe the Bug
We have a "CustomeAPIError" class used to throw custom error toasts from hooks:
These are used mainly for displaying descriptive error messages to the user when deleting records from a collection. It works as expected when deleting a record from the individual record view.
However, when deleting from the list view the custom error message is not displayed. Instead a generic "Unable to delete n out of n records" is displayed.
To Reproduce
Throw a CustomAPIError from a beforeDelete hook.
Currently using v2.22.0 but this has been an issue in all v2 versions.
Payload Version
2.22.0
Adapters and Plugins
bundler-webpack, db-mongodb, plugin-cloud, richtext-slate