Files
payloadcms/test/admin/components/EditMenuItemsServer/index.tsx
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

14 lines
300 B
TypeScript

import type { EditMenuItemsServerProps } from 'payload'
import React from 'react'
export const EditMenuItemsServer = (props: EditMenuItemsServerProps) => {
const href = `/custom-action?id=${props.id}`
return (
<div>
<a href={href}>Custom Edit Menu Item (Server)</a>
</div>
)
}