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

Bug: Uploading image in hasMany field populates unrelated upload field #10177

Closed
adesombergh opened this issue Dec 26, 2024 · 3 comments · Fixed by #10189
Closed

Bug: Uploading image in hasMany field populates unrelated upload field #10177

adesombergh opened this issue Dec 26, 2024 · 3 comments · Fixed by #10189

Comments

@adesombergh
Copy link

adesombergh commented Dec 26, 2024

Describe the Bug

When using PayloadCMS with a collection or global that includes:

  1. An upload field with hasMany enabled.
  2. Another upload field placed after it.

If you use the “Create New” option in the first upload field (hasMany), the uploaded image unexpectedly populates the second upload field and leaves the first one empty.

Link to the code that reproduces this issue

https://github.com/adesombergh/payload

Reproduction Steps

  1. Create a collection or global with:
    • An upload field with hasMany enabled.
    • A second upload field immediately following it.
  2. Go to the admin panel and create a new document in the collection (or edit the global).
  3. For the hasMany upload field:
    • Select “Create New” and upload an image.
  4. Observe that the second upload field is unexpectedly populated with the uploaded image, while the first one stays empty.

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

core, ui

Environment Info

Payload: 3.11.0
Next: 15.0.3
Node: 20.18.1
@adesombergh adesombergh added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Dec 26, 2024
@akhrarovsaid
Copy link
Contributor

Yeah, I've reproduced this. I think this is happening because the UploadField component sets an onSuccess callback for the bulk drawer component, however only a hasMany upload field actually makes use of it. By setting it for non-hasMany fields, you get this bug here. I'll have a PR out for this right after I test a few more scenarios.

Copy link
Contributor

🚀 This is included in version v3.12.0

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 Dec 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants