-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Description
Bug Report
Relationship field component fails to be populated with options, when it is a relation to multiple collections, and the field doesn't have a value.
Expected Behavior
Should see all available values from the various collections as options in the relationship select.
Current Behavior
Seeing only "None", and the following error in the console:
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'relationTo')
at createRelationMap (createRelationMap.js:23:1)
at index.js:49:46
at index.js:158:1
at invokePassiveEffectCreate (react-dom.development.js:23487:1)
at HTMLUnknownElement.callCallback (react-dom.development.js:3945:1)
at HTMLUnknownElement.dispatchEvent (<anonymous>)
at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:1)
at invokeGuardedCallback (react-dom.development.js:4056:1)
at flushPassiveEffectsImpl (react-dom.development.js:23574:1)
at unstable_runWithPriority (scheduler.development.js:468:1)
Possible Solution
I think in admin/components/forms/field-types/Relationship/createRelationMap.ts
line 38, it should be else if (hasMultipleRelations && value)
rather than just else if (hasMultipleRelations)
.
Steps to Reproduce
- Define a field like so:
{name: 'test', type: 'relationship', relationTo: ['some-other-collection']}
- Ensure
some-other-collection
has values - In the admin form, add a new item (at this point the error will show in the console)
- Click the relation field to find values to fill in (at this point you will see just None instead of real options)
Detailed Description
Payload version 0.14.25-beta.0
Metadata
Metadata
Assignees
Labels
No labels