fix(ui): table custom label missing client field props (#10540)

Fixes #9663. The `field` prop was not passed to custom label components
within the list view table.

<img width="1366" alt="Screenshot 2025-01-13 at 16 05 34"
src="https://github.com/user-attachments/assets/efae9f92-ffad-46dd-aec8-e1f968f9f278"
/>

---------

Co-authored-by: Jacob Fletcher <jacobsfletch@gmail.com>
This commit is contained in:
Amelia
2025-01-13 17:58:46 +01:00
committed by GitHub
parent cc13ae77fb
commit 415fbf1341

View File

@@ -1,6 +1,7 @@
import type { I18nClient } from '@payloadcms/translations'
import type {
ClientCollectionConfig,
ClientComponentProps,
ClientField,
DefaultCellComponentProps,
DefaultServerCellComponentProps,
@@ -164,8 +165,17 @@ export const buildColumnState = (args: Args): Column[] => {
? _field.admin.components.Label
: undefined
// TODO: customComponent will be optional in v4
const clientProps: Omit<ClientComponentProps, 'customComponents'> = {
field,
}
const CustomLabel = CustomLabelToRender
? RenderServerComponent({ Component: CustomLabelToRender, importMap: payload.importMap })
? RenderServerComponent({
clientProps,
Component: CustomLabelToRender,
importMap: payload.importMap,
})
: undefined
const fieldAffectsDataSubFields =