File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
packages/plugin-nested-docs/src Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11import type { Plugin , SingleRelationshipField } from 'payload'
22
3+ import { flattenAllFields } from 'payload'
4+
35import type { NestedDocsPluginConfig } from './types.js'
46
57import { createBreadcrumbsField } from './fields/breadcrumbs.js'
@@ -20,12 +22,14 @@ export const nestedDocsPlugin =
2022 if ( pluginConfig . collections . indexOf ( collection . slug ) > - 1 ) {
2123 const fields = [ ...( collection ?. fields || [ ] ) ]
2224
23- const existingBreadcrumbField = collection . fields . find (
25+ const flattenedFields = flattenAllFields ( { fields : collection . fields } )
26+
27+ const existingBreadcrumbField = flattenedFields . find (
2428 ( field ) =>
2529 'name' in field && field . name === ( pluginConfig ?. breadcrumbsFieldSlug || 'breadcrumbs' ) ,
2630 )
2731
28- const existingParentField = collection . fields . find (
32+ const existingParentField = flattenedFields . find (
2933 ( field ) => 'name' in field && field . name === ( pluginConfig ?. parentFieldSlug || 'parent' ) ,
3034 ) as SingleRelationshipField
3135
You can’t perform that action at this time.
0 commit comments