From 64dd9763f11f17a045b9cacd43449431e607f9f2 Mon Sep 17 00:00:00 2001 From: sacha-c Date: Wed, 11 Dec 2024 17:29:34 +0100 Subject: [PATCH] test: adds server component prop reproduction bug --- test/_community/collections/Posts/index.ts | 14 ++++++++++++++ .../components/FieldServerComponentIssue.tsx | 9 +++++++++ 2 files changed, 23 insertions(+) create mode 100644 test/_community/components/FieldServerComponentIssue.tsx diff --git a/test/_community/collections/Posts/index.ts b/test/_community/collections/Posts/index.ts index ffed2abbd1e..ff1108b03a3 100644 --- a/test/_community/collections/Posts/index.ts +++ b/test/_community/collections/Posts/index.ts @@ -12,6 +12,20 @@ export const PostsCollection: CollectionConfig = { name: 'title', type: 'text', }, + { + name: 'bugReproduction', + type: 'ui', + admin: { + components: { + Field: { + path: 'test/_community/components/FieldServerComponentIssue', + serverProps: { + myValue: () => 'hello world', // As a serverProp, I expect to be able to pass function and other unserializable data + }, + }, + }, + }, + }, ], versions: { drafts: true, diff --git a/test/_community/components/FieldServerComponentIssue.tsx b/test/_community/components/FieldServerComponentIssue.tsx new file mode 100644 index 00000000000..aaed92c71b7 --- /dev/null +++ b/test/_community/components/FieldServerComponentIssue.tsx @@ -0,0 +1,9 @@ +import type { FieldServerComponent } from 'payload' + +const FieldServerComponentIssue: FieldServerComponent string }> = ( + props, +) => { + return
{props.value()}
+} + +export default FieldServerComponentIssue