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

Deleted media that included in upload field hasMany, showing undefined id in admin panel #9328

Open
henrytrianta opened this issue Nov 19, 2024 · 2 comments · May be fixed by #9426
Open

Deleted media that included in upload field hasMany, showing undefined id in admin panel #9328

henrytrianta opened this issue Nov 19, 2024 · 2 comments · May be fixed by #9426
Labels
status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@henrytrianta
Copy link

Describe the Bug

When an item media deleted from collection, that is already linked to upload field with an option hasMany: true, causing error: Cannot read properties of undefined (reading 'id').

@paulpopus

Link to the code that reproduces this issue

https://github.com/henrytrianta/payload-reproduce-has-many-issue

Reproduction Steps

  1. Create an item in collection posts
  2. Upload multiple images to post
  3. Go to Media and delete one of the image
  4. Go back to post that have the images that is already linked in but deleted
  5. There is an error saying: Cannot read properties of undefined (reading 'id').

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

area: core, Not sure

Environment Info

Binaries:
  Node: 22.9.0
  npm: 10.8.3
  Yarn: 1.22.22
  pnpm: 9.11.0
Relevant Packages:
  payload: 3.0.0
  next: 15.0.0
  @payloadcms/db-mongodb: 3.0.0
  @payloadcms/email-nodemailer: 3.0.0
  @payloadcms/graphql: 3.0.0
  @payloadcms/next/utilities: 3.0.0
  @payloadcms/payload-cloud: 3.0.0
  @payloadcms/richtext-lexical: 3.0.0
  @payloadcms/translations: 3.0.0
  @payloadcms/ui/shared: 3.0.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.1.0: Thu Oct 10 21:02:45 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8112
  Available memory (MB): 8192
  Available CPU cores: 8
@henrytrianta henrytrianta added status: needs-triage Possible bug which hasn't been reproduced yet v3 validate-reproduction labels Nov 19, 2024
@denolfe denolfe removed the v3 label Nov 19, 2024
@poofy25
Copy link

poofy25 commented Nov 20, 2024

i am also facing the same issue

@akhrarovsaid
Copy link
Contributor

Yep, I've reproduced your issue. Many ways to handle this honestly, I pursued the one that made the most sense to me from an editors pov. PR is here.

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

Successfully merging a pull request may close this issue.

4 participants