fix(ui): create-first-user crashes when users collection has join field (#10871)

Fixes https://github.com/payloadcms/payload/issues/10870
Now we hide join fields from the `/create-first-user` view since they're
not meaningful there.
This commit is contained in:
Sasha
2025-01-29 19:52:22 +02:00
committed by GitHub
parent 5bd17cc111
commit 2f66bdc2dc
5 changed files with 80 additions and 41 deletions

View File

@@ -161,18 +161,22 @@ const JoinFieldComponent: JoinFieldClientComponent = (props) => {
}
return where
}, [docID, field.targetField.relationTo, field.where, on, docConfig.slug])
}, [docID, field.targetField.relationTo, field.where, on, docConfig?.slug])
const initialDrawerData = useMemo(() => {
const relatedCollection = getEntityConfig({ collectionSlug: field.collection })
return getInitialDrawerData({
collectionSlug: docConfig.slug,
collectionSlug: docConfig?.slug,
docID,
fields: relatedCollection.fields,
segments: field.on.split('.'),
})
}, [getEntityConfig, field.collection, field.on, docConfig.slug, docID])
}, [getEntityConfig, field.collection, field.on, docConfig?.slug, docID])
if (!docConfig) {
return null
}
return (
<div