Skip to content

Commit 8fdd88b

Browse files
authored
fix: webpack error if dbName or enumName was set (#7184)
Something like this: ```ts { name: 'select', type: 'select', dbName: ({ tableName }) => `${tableName}_customSelect`, enumName: 'selectEnum', hasMany: true, options: ['a', 'b', 'c'], }, ``` caused the "Functions cannot be passed directly to Client Components" error, as the dbName function was sent to the client. Now, you can run `pnpm dev database` again without it erroring
1 parent 676dfa3 commit 8fdd88b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/payload/src/fields/config/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import type { Field, FieldBase } from '../../fields/config/types.js'
55
export type ClientFieldConfig = Omit<Field, 'access' | 'defaultValue' | 'hooks' | 'validate'>
66

77
export type ServerOnlyFieldProperties =
8+
| 'dbName' // can be a function
89
| 'editor' // This is a `richText` only property
10+
| 'enumName' // can be a function
911
| 'filterOptions' // This is a `relationship` and `upload` only property
1012
| 'label'
1113
| 'typescriptSchema'
@@ -35,6 +37,8 @@ export const createClientFieldConfig = ({
3537
'editor', // This is a `richText` only property
3638
'custom',
3739
'typescriptSchema',
40+
'dbName', // can be a function
41+
'enumName', // can be a function
3842
// `fields`
3943
// `blocks`
4044
// `tabs`

0 commit comments

Comments
 (0)