Skip to content

Create item in empty collection with folders enabled #12502

@JesperWe

Description

@JesperWe

Describe the Bug

Going into the collections with folders: true and clicking "Create New" causes a crash:

 GET /admin/collections/members/create 200 in 45ms
 ⨯ TypeError: Cannot destructure property 'config' of '(0 , _providers_Config_index_js__WEBPACK_IMPORTED_MODULE_9__.useConfig)(...)' as it is undefined.
    at MoveDocToFolder (../../../../src/elements/FolderView/MoveDocToFolder/index.tsx:46:2)
  44 |   const [fromFolderName, setFromFolderName] = React.useState(() => `${t('general:loading')}...`)
  45 |
> 46 |   const { config } = useConfig()
     |  ^
  47 |   const modalID = useId()
  48 |
  49 |   React.useEffect(() => { {
  digest: '4115836182'
}

Link to the code that reproduces this issue

https:... Cannot build due to other crash, so only pnpm dev at the moment

Reproduction Steps

I am testing the new folders in 3.39.0.

I have enabled folders on a couple of collections in an existing project (using postgres).
Starting using pnpm dev with an empty database, so all tables are created from scratch.

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

area: core

Environment Info

Binaries:
  Node: 20.11.0
  npm: 10.8.2
  Yarn: 1.22.22
  pnpm: 10.11.0
Relevant Packages:
  payload: 3.39.0
  next: 15.3.2
  @payloadcms/db-postgres: 3.39.0
  @payloadcms/email-nodemailer: 3.39.0
  @payloadcms/graphql: 3.39.0
  @payloadcms/next/utilities: 3.39.0
  @payloadcms/payload-cloud: 3.39.0
  @payloadcms/plugin-cloud-storage: 3.39.0
  @payloadcms/richtext-lexical: 3.39.0
  @payloadcms/storage-s3: 3.39.0
  @payloadcms/translations: 3.39.0
  @payloadcms/ui/shared: 3.39.0
  react: 19.1.0
  react-dom: 19.1.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions