From 02ff97d5a4c7d98d1a66c16e6198c2b0eddb26ad Mon Sep 17 00:00:00 2001 From: Luan Taraschi <130802253+luantaraschi@users.noreply.github.com> Date: Thu, 6 Aug 2026 18:04:30 -0300 Subject: [PATCH] fix(ui): stop showing [Untitled] in the folder drawer during bulk edit 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 || ` 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 #17669 --- .../FolderView/MoveDocToFolder/index.tsx | 5 +++- test/folders/e2e.spec.ts | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/elements/FolderView/MoveDocToFolder/index.tsx b/packages/ui/src/elements/FolderView/MoveDocToFolder/index.tsx index 08b997c1156..ad34fc8bf89 100644 --- a/packages/ui/src/elements/FolderView/MoveDocToFolder/index.tsx +++ b/packages/ui/src/elements/FolderView/MoveDocToFolder/index.tsx @@ -73,7 +73,10 @@ export function MoveDocToFolder({ collectionSlug={collectionSlug} docData={initialData as FolderOrDocument['value']} docID={id} - docTitle={title} + // In bulk edit there is no document, so `title` resolves to the `[Untitled]` + // placeholder. Passing `undefined` lets the button fall back to the + // collection's singular label instead of showing a fake document title. + docTitle={id ? title : undefined} folderCollectionSlug={folderCollectionSlug} folderFieldName={folderFieldName} fromFolderID={fromFolderID as number | string} diff --git a/test/folders/e2e.spec.ts b/test/folders/e2e.spec.ts index bd607d14ad9..79df0166d59 100644 --- a/test/folders/e2e.spec.ts +++ b/test/folders/e2e.spec.ts @@ -564,6 +564,31 @@ test.describe('Folders', () => { ) }) + test('should not title the folder drawer "[Untitled]" when bulk editing', async () => { + await page.goto(postURL.list) + + await page.locator('tbody .row-1 input[type="checkbox"]').check() + await page.locator('.edit-many__toggle').click() + + const bulkEditForm = page.locator('form.edit-many__form') + await expect(bulkEditForm).toBeVisible() + + await selectInput({ + multiSelect: true, + options: ['Folder'], + page, + selectLocator: bulkEditForm.locator('.react-select'), + }) + + await bulkEditForm.locator('.move-doc-to-folder').click() + + // There is no document in bulk edit, so the heading must fall back to the + // collection's singular label rather than the `[Untitled]` placeholder. + const drawerHeading = page.locator('dialog .drawer-action-header__title') + await expect(drawerHeading).toBeVisible() + await expect(drawerHeading).toHaveText('Select folder for Post') + }) + test('should resolve folder pills and not get stuck as Loading...', async () => { await selectFolderAndConfirmMoveFromList({ folderName: 'Move Into This Folder', page }) const folderPill = page.locator('tbody .row-1 .move-doc-to-folder')