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

Filtered Bulk Delete Ends Up Deleting Everything #9374

Closed
nathanclevenger opened this issue Nov 20, 2024 · 7 comments · Fixed by #9377
Closed

Filtered Bulk Delete Ends Up Deleting Everything #9374

nathanclevenger opened this issue Nov 20, 2024 · 7 comments · Fixed by #9377

Comments

@nathanclevenger
Copy link
Contributor

Describe the Bug

If a list view is searched, and then the Select all x Resources is clicked, and then if delete is selected, all documents from the collection are deleted not just the filtered/selected items.

This is an extremely serious issue - we just had to roll back a database to backup and lost data because of this bug.

Link to the code that reproduces this issue

https://github.com/nathanclevenger/payload-repro

Reproduction Steps

Go to a collection list view:
Image

Enter a search term:
Image

Hit the top checkbox to select all:
Image

Hit the link to "Select All x Resources:
Image

Hit Delete, and Confirm: (note, it shows the filtered count here)
Image

Then all resources in the collection will be deleted:
Image

I confirmed this exists in both Mongo and Postgres

Which area(s) are affected? (Select all that apply)

Not sure

Environment Info

Payload: 3.0.1
Nextjs: 15.0.0
Node: 20.13.1
@jacobsfletch
Copy link
Member

@nathanclevenger I'm unable to reproduce this within either our test suite or the reproduction repo you've provided. Here's a quick screen recording from my end using the steps you've outlined:

issue-9374-no-repro.mp4

@tyteen4a03
Copy link
Contributor

@nathanclevenger I'm unable to reproduce this within either our test suite or the reproduction repo you've provided. Here's a quick screen recording from my end using the steps you've outlined:
issue-9374-no-repro.mp4

Similar to #9264, maybe the issue only appears if you follow the instructions exactly? Your setup has 3 and you select 1, while their setup has 4 and selected 3.

@jacobsfletch
Copy link
Member

Ahh @nathanclevenger missed a step, just coming back in here to confirm but I see @tyteen4a03 is too quick for me. Looking into it.

@jacobsfletch
Copy link
Member

Your setup has 3 and you select 1, while their setup has 4 and selected 3.

For the record it's the "Hit the link to "Select All x Resources" step that reproduces this issue. Not the number of documents.

@nathanclevenger
Copy link
Contributor Author

Your setup has 3 and you select 1, while their setup has 4 and selected 3.

For the record it's the "Hit the link to "Select All x Resources" step that reproduces this issue. Not the number of documents.

Yes, it's the Select All x Resources that causes this issue ... I just confirmed it also affects Updates as well as Deletes

Copy link
Contributor

🚀 This is included in version v3.0.2

Copy link
Contributor

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants