fix(ui): stop showing [Untitled] in the folder drawer during bulk edit - #17696
Open
luantaraschi wants to merge 1 commit into
Open
fix(ui): stop showing [Untitled] in the folder drawer during bulk edit#17696luantaraschi wants to merge 1 commit into
luantaraschi wants to merge 1 commit into
Conversation
EditMany renders its fields inside a DocumentInfoProvider with `id={null}` and
`initialData={{}}`. formatDocTitle then has no title and no string fallback, so
useDocumentInfo().title resolves to the `[Untitled]` placeholder.
MoveDocToFolder passed that straight through as `docTitle`, and because
`"[Untitled]"` is truthy, the existing `docTitle || <singular label>` fallback in
MoveDocToFolderButton never ran. Editors bulk editing a folder field saw
"Select folder for [Untitled]" even with a single, clearly named document selected.
Narrow `docTitle` to the document title only when a document id exists, so the
fallback resolves to the collection's singular label.
Fixes payloadcms#17669
luantaraschi
requested review from
AlessioGr,
JarrodMFlesch and
jacobsfletch
as code owners
August 6, 2026 21:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #17669
Targeting
3.xper the PR template: this is a v3 bug fix. The folder UI was reworked intoHierarchyonmain— there is nofolder:translation namespace and noFolderViewdirectory there — so the reported behaviour does not exist on v4.What?
Bulk editing a folder field opened the folder-select drawer titled "Select folder for [Untitled]", even when a single, clearly named document was selected.
Why?
The chain, traced on
3.xat57278bd9(v3.87.1):elements/EditMany/DrawerContent.tsx:320renders its fields inside aDocumentInfoProviderwithid={null}andinitialData={{}}— correct, since bulk edit has no document.providers/DocumentInfo/index.tsx:89computestitleviaformatDocTitle({ …, fallback: id?.toString() }), sofallbackisundefined.utilities/formatDocTitle/index.ts:76— with nouseAsTitlevalue and no string fallback — returns`[${i18n.t('general:untitled')}]`.FolderView/MoveDocToFolder/index.tsx:76passed that value through asdocTitle.MoveDocToFolderButtonalready has the right fallback at line 137:"[Untitled]"is a truthy string.So the correct behaviour was already implemented — it was just unreachable.
How?
With no document id,
docTitleisundefinedand the existing fallback resolves to the collection's singular label: "Select folder for Post".This also improves
BulkUpload/EditForm, the other consumer ofMoveDocToFolder, where new uploads have no id yet.Added an e2e test in
test/folders/e2e.spec.tsunderCollection view actions, which asserts the drawer heading is exactlySelect folder for Postafter opening the folder chip from the bulk edit form.Testing performed
I could not run the suite locally, and I would rather say so than imply otherwise.
pnpm installfails on Windows duringpostinstall:@vercel/git-hooksthrowsEPERM: symlinkcreating.git/hooks/applypatch-msg, which aborts the lifecycle and leavesnode_modules/.binempty.What I can state precisely:
docTitle?: stringtostring | undefined, so it cannot introduce a type error.Please have CI or a maintainer confirm the new test fails without the fix and passes with it.
Notes for the reviewer
Scope. The issue also reports that the chip renders the
folder:noFolderlabel even when every selected document is in a folder. That has a different root cause — bulk-edit fields are setters and do not load current values — and arguably no single correct value exists across N documents. I left it out to keep this to one logical change; happy to take it in a follow-up if you want it addressed.Why not a count-based heading. The issue suggests reusing the Move flow's
"N Items"title.MoveToFolderdoes support that viaaction="moveItemsToFolder", but the count lives inuseSelection(), andMoveDocToFolderis also rendered on the document edit view where noSelectionProviderexists — a hook call there would break. Fields are also rendered generically by the form, so the count cannot be threaded down as a prop to one specific field. The singular-label fallback needs no new plumbing and is already the component's declared intent.