Skip to content

When opening Drawer of upload - Error is logged  #7497

@tsemachh

Description

@tsemachh

Link to reproduction

No response

Payload Version

3.0.0-beta.73

Node Version

v22.5.1

Next.js Version

15.0.0-canary.59

Describe the Bug

When opening drawer(like media drawer) error is written to the log.
This relates to next fixed issue
(https://github.com/payloadcms/payload/pull/7117/files)
In file:
packages/ui/src/utilities/buildFormState.ts - Lines 70-74
` const schemaPathSegments = schemaPath && schemaPath.split('.')

let fieldSchema: Field[]

if (schemaPathSegments.length === 1) {
`
What happens is the first line fixes case where schemaPath is null | undefined,
now the last line there fails of schemaPathSegments is null | undefined

Reproduction Steps

Launch clean payload website
Get a pop-up window (or by uploading new media, creating a new object in a relationship filed by the "+" button, editing an object in a relationship filed etc)
Go to the console window next error appears:
TypeError: Cannot read properties of undefined (reading 'length') at s (webpack://cmweb2/node_modules/.pnpm/@payloadcms+ui@3.0.0-beta.73_monaco-editor@0.38.0_next@15.0.0-canary.59_react-dom@19.0.0-rc-6_pkgadj7m7kr4pzubcssln6zqda/node_modules/@payloadcms/ui/dist/utilities/buildFormState.js:56:1) at Object.tG (webpack://cmweb2/node_modules/.pnpm/@payloadcms+next@3.0.0-beta.73_graphql@16.9.0_monaco-editor@0.38.0_next@15.0.0-canary.59_reac_n6ltizgmd5y7vof4nhh6owui3i/node_modules/@payloadcms/next/dist/routes/rest/buildFormState.js:11:30) at <anonymous> (webpack://cmweb2/node_modules/.pnpm/@payloadcms+next@3.0.0-beta.73_graphql@16.9.0_monaco-editor@0.38.0_next@15.0.0-canary.59_reac_n6ltizgmd5y7vof4nhh6owui3i/node_modules/@payloadcms/next/dist/routes/rest/index.js:505:1) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async /app/node_modules/.pnpm/next@15.0.0-canary.59_react-dom@19.0.0-rc-6230622a1a-20240610_react@19.0.0-rc-6230622a1a-2024_4ufrqkh5d53l6fnnndwj65u64a/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:38428 at async ek.execute (/app/node_modules/.pnpm/next@15.0.0-canary.59_react-dom@19.0.0-rc-6230622a1a-20240610_react@19.0.0-rc-6230622a1a-2024_4ufrqkh5d53l6fnnndwj65u64a/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:28642) at async ek.handle (/app/node_modules/.pnpm/next@15.0.0-canary.59_react-dom@19.0.0-rc-6230622a1a-20240610_react@19.0.0-rc-6230622a1a-2024_4ufrqkh5d53l6fnnndwj65u64a/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39729) at async doRender (/app/node_modules/.pnpm/next@15.0.0-canary.59_react-dom@19.0.0-rc-6230622a1a-20240610_react@19.0.0-rc-6230622a1a-2024_4ufrqkh5d53l6fnnndwj65u64a/node_modules/next/dist/server/base-server.js:1402:42) at async responseGenerator (/app/node_modules/.pnpm/next@15.0.0-canary.59_react-dom@19.0.0-rc-6230622a1a-20240610_react@19.0.0-rc-6230622a1a-2024_4ufrqkh5d53l6fnnndwj65u64a/node_modules/next/dist/server/base-server.js:1666:28) at async NextNodeServer.renderToResponseWithComponentsImpl (/app/node_modules/.pnpm/next@15.0.0-canary.59_react-dom@19.0.0-rc-6230622a1a-20240610_react@19.0.0-rc-6230622a1a-2024_4ufrqkh5d53l6fnnndwj65u64a/node_modules/next/dist/server/base-server.js:1673:28)

Adapters and Plugins

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions