-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Only one file is saved when uploading multiple images in a multiple field. #9890
Comments
manutepowa
added
status: needs-triage
Possible bug which hasn't been reproduced yet
validate-reproduction
labels
Dec 11, 2024
manutepowa
changed the title
Only One File Is Saved When Uploading Multiple Images in a Multi-Image Field
Only one file is saved when uploading multiple images in a multiple field.
Dec 11, 2024
@manutepowa Yup. Reproduced in monorepo |
github-actions
bot
removed
the
status: needs-triage
Possible bug which hasn't been reproduced yet
label
Dec 12, 2024
PatrikKozak
added a commit
that referenced
this issue
Dec 17, 2024
…ata overriding old docs (#9918) <!-- Thank you for the PR! Please go through the checklist below and make sure you've completed all the steps. Please review the [CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md) document in this repository if you haven't already. The following items will ensure that your PR is handled as smoothly as possible: - PR Title must follow conventional commits format. For example, `feat: my new feature`, `fix(plugin-seo): my fix`. - Minimal description explained as if explained to someone not immediately familiar with the code. - Provide before/after screenshots or code diffs if applicable. - Link any related issues/discussions from GitHub or Discord. - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Fixes # --> ### What? This PR fixes an issue where bulk upload on an upload field with hasMany, which had errors on sequential uploads, caused only the last successful upload to be saved to the field value. ### Why? To save all successful uploads to the field value and sync what was shown in the ui to the actual field data. ### How? By triggering a rerender that syncs `populatedDocs` to the fields `value` on each sequential successful upload after form errors were resolved. Fixes #9890 Before: [Bulk-upload-before--Post---Payload.webm](https://github.com/user-attachments/assets/6396a88b-21c2-4037-b1ef-fd7f8d16103f) After: [Bulk-upload-after---Payload.webm](https://github.com/user-attachments/assets/8566a022-6e86-46c7-87fe-78d01e6dd8c9) Notes: - The core issue was that onSuccess function was not properly syncing the correct field values resulting in stale values that would overwrite old docs. --------- Co-authored-by: Patrik Kozak <patrik@payloadcms.com>
🚀 This is included in version v3.9.0 |
This issue has been automatically locked. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the Bug
When configuring an image field with the
hasMany: true
option, attempting to upload multiple files at once results in only one of the files being saved correctly in the database.Link to the code that reproduces this issue
https://github.com/payloadcms/payload
Reproduction Steps
Video
https://github.com/user-attachments/assets/3ed984c0-f958-4d36-8c8d-7c2400cfad66
Field config.
Which area(s) are affected? (Select all that apply)
area: core
Environment Info
The text was updated successfully, but these errors were encountered: