Files
payload/test/admin/collections/CustomViews1.ts
Jacob Fletcher cb9b80aaf9 fix!: handles custom collection description components (#7789)
## Description

Closes #7784 by properly handling custom collection description
components via `admin.components.Description`. This component was
incorrectly added to the `admin.components.edit` key, and also was never
handled on the front-end. This was especially misleading because the
client-side config had a duplicative key in the proper position.

## Breaking Changes

This PR is only labeled as a breaking change because the key has changed
position within the config. If you were previously defining a custom
description component on a collection, simply move it into the correct
position:

Old:
```ts
{
  admin: {
    components: {
      edit: {
        Description: ''
      }
    }
  }
}
```

New:

```ts
{
  admin: {
    components: {
      Description: ''
    }
  }
}
```

- [x] I have read and understand the
[CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md)
document in this repository.

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [x] This change requires a documentation update

## Checklist:

- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] Existing test suite passes locally with my changes
- [x] I have made corresponding changes to the documentation
2024-08-21 10:20:22 -04:00

29 lines
744 B
TypeScript

import type { CollectionConfig } from 'payload'
import { customViews1CollectionSlug } from '../slugs.js'
export const CustomViews1: CollectionConfig = {
slug: customViews1CollectionSlug,
admin: {
components: {
Description: '/components/ViewDescription/index.js#ViewDescription',
views: {
// This will override the entire Edit View including all nested views, i.e. `/edit/:id/*`
// To override one specific nested view, use the nested view's slug as the key
edit: {
root: {
Component: '/components/views/CustomEdit/index.js#CustomEditView',
},
},
},
},
},
fields: [
{
name: 'title',
type: 'text',
},
],
versions: true,
}