Bulk upload from a `hasMany` upload field: closing the drawer once without uploading silently drops the next upload (docs created, field unchanged)
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- nextjs, react, typescript
- Domain
- frontend
Research direction
The callback is reset in elements/BulkUpload/index.tsx inside the onModalStateChanged effect, and onLocalFileSelection in fields/Upload/Input.tsx opens the drawer without re-registering it. Start by reading how setOnSuccess is registered in both files, then reproduce the steps: close the drawer without uploading, reopen it, upload, and check whether the field value updates. Done means the field list includes the new documents after the second upload, without a page reload.
Written by the indexing model from the issue text.
Description
Describe the Bug
In a hasMany upload field, open the bulk upload drawer with "Create New", close it without uploading (X → "Leave anyway", click outside, or Escape), then open it again and upload files. The documents are created on the server, the toast says "Successfully saved N files", the drawer closes — but the field value is not updated: nothing is added to the list. Reloading the page restores the normal behaviour.
Cause (read in @payloadcms/ui 3.90.2 dist and in main):
elements/BulkUpload/index.tsx— in theonModalStateChangedeffect, every close of the drawer resets the success callback to a no-op (setOnSuccess(() => () => null)).fields/Upload/Input.tsx—onLocalFileSelectionopens the drawer without re-registering the callback; it is only (re)registered byuseEffect(() => { setOnSuccess(onUploadSuccess) }, [value, path, onUploadSuccess, setOnSuccess]), andonUploadSuccessis memoized on[value, …]. After a close with no upload, the value has not changed, so the callback stays a no-op for the rest of the page session.
Related: #17560 (proposes registering the callback at open time, which would also cover this case).
Suggested fix: in onLocalFileSelection, call setOnSuccess(onUploadSuccess) right before openModal(drawerSlug) (and add both to the dependency array) — or stop resetting the callback on close, since each upload field has its own BulkUploadProvider.
Link to the code that reproduces this issue
Reproduces with the stock hasMany upload field, no custom code: any collection with { name: 'photos', type: 'upload', relationTo: 'media', hasMany: true }.
Reproduction Steps
- Edit a document that has a
hasManyupload field. - Click "Create New" in the field → the bulk upload drawer opens.
- Close it without adding files (X, or click the dimmed background).
- Click "Create New" again, add 2 files, click "Save".
- Toast "Successfully saved 2 files", drawer closes.
- Expected: the 2 new documents appear in the field list (unsaved). Actual: the list is unchanged; the documents exist in the collection.
- Reload the page and repeat steps 4–5 without step 3: works.
Which area(s) are affected?
area: ui
Environment Info
- Payload 3.90.2, @payloadcms/ui 3.90.2, @payloadcms/db-postgres 3.90.2
- Next.js 16.3.8, React 19.3.0, Node 24
- Browsers: Safari iOS 26 and Chrome 142 (desktop)
- Dominant language
- TypeScript
- Stars
- 45.3k
- Forks
- 4.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 238
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from payloadcms/payload
-
bug: Local API call with req resets req.fallbackLocale to defaultLocalePossibly taken A pull request linked to this issue is open or already merged. Openarea: core Bug created-by: Contributor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
payloadcms/payload#18768 ·
Maintainers usually reply within 1 day
-
[plugin-multi-tenant] Infinite redirect loop with custom tenantFieldName and isGlobal collectionsPossibly taken A pull request linked to this issue is open or already merged. OpenBug plugin: multi-tenant status: needs-triage v3
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
payloadcms/payload#18690 ·
Maintainers usually reply within 1 day
-
Global update drops overrideAccess, so Local API updateGlobal fails filterOptions validation (3.90 regression)Possibly taken @PINYOPATTANAWASANPORN claimed this 7 days ago. Openarea: core Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#18674 · 1 comment ·
Maintainers usually reply within 1 day
-
db-postgres: connect() rejects its `initializing` promise with no argument, producing an unhandledRejection with reason `undefined`Possibly taken @Metehan-Bicer claimed this 10 days ago. Openarea: db-postgres Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#18656 · 1 comment ·
Maintainers usually reply within 1 day
-
plugin-cloud-storage: unused `find-node-modules` dependency pulls in `braces` (GHSA-vfj7-8cjw-p6xm, no patched version)Possibly taken @MokiMeow claimed this 11 days ago. OpenBug plugin: cloud-storage plugin: storage-* status: needs-triage v3
Difficulty 1/5 Under an hour Newbie friendliness 75/100
payloadcms/payload#18623 ·
Maintainers usually reply within 1 day
All issues in payloadcms/payload
Similar issues
-
area: repo priority: P2 type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
appandflow/stim#4107 · 1 comment ·
Maintainers usually reply within 1 day
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 1-3 hours Newbie friendliness 60/100
lingdojo/kana-dojo#32859 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
github/gh-aw-firewall#10364 ·
Maintainers usually reply within 1 day
-
Merge the duplicate kaffir_corn record into sorghumPossibly taken @Crypto-Shroom claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Crypto-Shroom/Bird-Feed-Calculator#322 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
drizzle-team/drizzle-orm#6552 ·
Maintainers usually reply within 2 days