Files
payload/test/admin/collections/editMenuItems.ts
Patrik 96074530b1 fix: server edit view components don't receive document id prop (#13526)
### What?

Make the document `id` available to server-rendered admin components
that expect it—specifically `EditMenuItems` and
`BeforeDocumentControls`—so `props.id` matches the official docs.

### Why?

The docs show examples using `props.id`, but the runtime `serverProps`
and TS types didn’t include it. This led to `undefined` at render time.

### How?

- Add id to ServerProps and set it in renderDocumentSlots from
req.routeParams.id.

Fixes #13420
2025-08-21 13:23:51 -04:00

28 lines
549 B
TypeScript

import type { CollectionConfig } from 'payload'
import { editMenuItemsSlug } from '../slugs.js'
export const EditMenuItems: CollectionConfig = {
slug: editMenuItemsSlug,
admin: {
components: {
edit: {
editMenuItems: [
{
path: '/components/EditMenuItems/index.js#EditMenuItems',
},
{
path: '/components/EditMenuItemsServer/index.js#EditMenuItemsServer',
},
],
},
},
},
fields: [
{
name: 'title',
type: 'text',
},
],
}