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.66k stars 1.72k forks source link

chore: type getViewFromConfig, add viewActions to serverProps #9404

Closed JarrodMFlesch closed 20 hours ago

JarrodMFlesch commented 22 hours ago

What?

viewActions are not easily accessible in custom views.

Why?

We extract view actions when we call getViewFromConfig, but never pass them to the custom views.

How?

Properly types return type for serverProps inside getViewFromConfig and adds viewActions to serverProps so they are spread into props when we build the custom view components.

Now custom server views will get the viewActions as a prop.

Fixes #9338