Skip to content

Can’t add custom view under new path to collection #15386

@robinscholz

Description

@robinscholz

We are currently trying to implement a custom grid view for a media collection in addition to the standard list and edit views, but fail to configure it.

We have tried multiple different path configs, none of which seem to be respected.

    const mediaCollectionWithViews = {
      ...mediaCollection,
      admin: {
        ...mediaCollection.admin,
        components: {
          ...mediaCollection.admin?.components,
          views: {
            ...(mediaCollection.admin?.components?.views ?? {}),
            grid: {
              Component: '@maas/payload-plugin-media-cloud/components#GridView',
              path: `/grid`,
              exact: true,
            },
          },
        },
      },
    }

Sadly this is rather poorly documented and I also can’t find a working example anywhere. My suspicion is that this is somehow not possible. Maybe due to the code here: https://github.com/payloadcms/payload/blob/main/packages/next/src/views/Root/getRouteData.ts ?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions