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

Bulk Edit causes deletion of array fields #9475

Open
thekiwi opened this issue Nov 23, 2024 · 1 comment
Open

Bulk Edit causes deletion of array fields #9475

thekiwi opened this issue Nov 23, 2024 · 1 comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@thekiwi
Copy link

thekiwi commented Nov 23, 2024

Describe the Bug

It seems that with 3.0.0 and newer (I've tried up to 3.1.0 but I haven't tested older versions) when using bulk edit to update one field causes Payload to delete another field of type array.

Link to the code that reproduces this issue

https://github.com/thekiwi/payload-bulk-edit-bug

Reproduction Steps

  1. Start the reproduction repo, pointing at a PostgreSQL database (I used 16.3)

  2. Log into the Admin panel (first creating a user, if necessary)

  3. Create a new Thing, leave 'enabled' unchecked, but add an entry to the 'foos' array
    Image

  4. View the list of things, you should see 1 Foos for the new thingImage

  5. Check the things_foos collection in the DB and observe there is now 1 record.
    Image

  6. Check the thing you just created and click "Edit" to start bulk editingImage

  7. Toggle the 'enabled' field to true for the thing you just created
    Image

  8. Click "Save"

  9. Return to the list of things, you should see 0 Foos for the thing you just edited
    Image

  10. Check the things_foos collection in the DB and observe there are now 0 records
    Image

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

db-postgres, area: core

Environment Info

Binaries:
  Node: 20.16.0
  npm: 10.8.1
  Yarn: 1.22.22
  pnpm: 9.7.0
Relevant Packages:
  payload: 3.1.0
  next: 15.0.0
  @payloadcms/db-postgres: 3.1.0
  @payloadcms/email-nodemailer: 3.1.0
  @payloadcms/graphql: 3.1.0
  @payloadcms/next/utilities: 3.1.0
  @payloadcms/payload-cloud: 3.1.0
  @payloadcms/richtext-lexical: 3.1.0
  @payloadcms/translations: 3.1.0
  @payloadcms/ui/shared: 3.1.0
  react: 19.0.0-rc-65a56d0e-20241020
  react-dom: 19.0.0-rc-65a56d0e-20241020
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.0.0: Tue Sep 24 23:39:07 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 8
@thekiwi thekiwi added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Nov 23, 2024
@akhrarovsaid
Copy link
Contributor

I've reproduced this in the Payload monorepo pre 3.2 release using both db-postgres and db-mongodb. The odd thing is that it happens 4 / 5 times with the fifth time working as expected. Will double check if it's still happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
Development

No branches or pull requests

2 participants