payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
23.57k stars 1.5k forks source link

"Delete" function deletes more than what's selected when using "Select all" #6326

Open DrMint opened 4 months ago

DrMint commented 4 months ago

Link to reproduction

No response

Describe the Bug

I wanted to delete a subset of all entries in a upload collection: the filenames starting with some prefix. There were hundreds of matching entries so I used the "Select all" function on the top right to select all entries (not only the entries on the current page). It is my understanding that this should select all matching entries, not simply ALL entries... and the number of selected entries after clicking on this function seems to reflect that.

Despite selecting only a subset of all entries in a collection, and despite the deletion confirmation modal displaying the right amount of selected entries, the deletion process actually deletes more entries than expected (all entries in this case).

To Reproduce

https://github.com/payloadcms/payload/assets/29893320/396384a6-243f-45a0-b68d-31ab24ccef95

(It seems the video fails to load on Firefox... please try on a Chromium-based browser)

Notes

I've tested other cases such as:

In both cases, the right amount of element were deleted when I used the Delete function. It seems the problem only arise when using the "Select all X [name of the collection]" button.

Payload Version

2.16.1

Adapters and Plugins

"@payloadcms/bundler-webpack": "1.0.6", "@payloadcms/db-mongodb": "1.5.1", "@payloadcms/richtext-lexical": "0.10.0"

riea commented 1 week ago

I can confirm this issue (Payload 2.28.0) - this will delete every entry in the collection by accident