payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
27.76k stars 1.72k forks source link

[Payload 3.0.1] Custom Server Components Not Receiving Any Properties #9359

Open danhstevens opened 2 days ago

danhstevens commented 2 days ago

Describe the Bug

According to the documentation (https://payloadcms.com/docs/admin/components#default-props), custom server components are provided with properties such as the payload class. However, no properties are passed into server components.

Example component:

import React from 'react'

export const TeamSelector = async ({ payload }) => {
  console.log('SHOULD HAVE A PAYLOAD OBJECT HERE', payload) // undefined
  return <div>123</div>
}

Expected Result: SHOULD HAVE A PAYLOAD OBJECT HERE [payload class data] Actual Result: SHOULD HAVE A PAYLOAD OBJECT HERE undefined

Link to the code that reproduces this issue

https://github.com/danhstevens/payload-issue

Reproduction Steps

  1. Create a new Payload project (v3)
  2. Add a custom server component that accepts any properties and apply to payload.config.ts
  3. Note how no properties are passed into the component

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

Payload: 3.0.1
Node: 20
JarrodMFlesch commented 1 day ago

Just noting that this has to do with the actions property specifically.

SelfhostedPro commented 23 hours ago

Also affects client components. Using the basic template from the docs here

This is all I have for config:

    components: {
      views: {
        dashboard: {
          Component: '@/components/payload/views/Root'
        }
      }
    }