Is there a way to get productUnit.isContainer without having to use API eg: payload.findByID? Is using the API here even efficient considering the data I need was already returned on page load and/or when user selects relationship field
Simplified example:
export const ProductUnits: CollectionConfig = {
slug: 'product-units',
fields: [
{
name: 'name',
type: 'text',
required: true,
},
{
name: 'isContainer',
type: 'checkbox',
defaultValue: false,
},
]
}
export const Products: CollectionConfig = {
slug: 'products',
fields: [
{
name: 'name',
type: 'text',
required: true,
},
{
name: 'productUnit',
type: 'relationship',
relationTo: 'product-units',
required: true,
},
{
name: 'allowManifest',
type: 'checkbox',
admin: {
condition: (data, siblingData, { user }) => {
// How to get isContainer?
if(data.productUnit.isContainer){
return true
}
else{
return false
}
}
},
}
]
}```