Skip to content

Commit

Permalink
fix(ui): table custom label missing client field props (#10540)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
LimChorngUan and jacobsfletch authored Jan 13, 2025
1 parent cc13ae7 commit 415fbf1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/ui/src/elements/TableColumns/buildColumnState.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { I18nClient } from '@payloadcms/translations'
import type {
ClientCollectionConfig,
ClientComponentProps,
ClientField,
DefaultCellComponentProps,
DefaultServerCellComponentProps,
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit 415fbf1

Please sign in to comment.