This may be a very specific use case, but it would be useful to retrieve an array of references for previews like so:
fields: [
{
title: 'Tags',
name: 'tags',
type: 'array',
of: [
{ type: 'reference', to: { type: 'tag' } }
]
}
],
preview: {
select: {
tags: 'tags[]->'
}
}
We are planning to improve this, but in the mean time you can do something like this:
preview: {
select: {
tag0: 'tags.0.value',
tag1: 'tags.1.value'
},
prepare(selection) {
return {
title: [selection.tag0, selection.tag1].join(', ')
}
}
}
Caveat: you must specify the full path of the value you want (I'm assuming the tag type has a value field here). E.g. selecting tags.1 will give you the reference value and that's probably not what you want here.
Most helpful comment
We are planning to improve this, but in the mean time you can do something like this:
Caveat: you must specify the full path of the value you want (I'm assuming the tag type has a
valuefield here). E.g. selectingtags.1will give you the reference value and that's probably not what you want here.