Skip to content

Commit

Permalink
docs(compensations): improve array preview comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiazom committed Sep 2, 2024
1 parent 2867ac6 commit c148dd0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion studio/schemas/documents/compensations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ const compensations = defineType({
preview: {
select: {
subtitle: "basicTitle",
// https://www.sanity.io/docs/previews-list-views#62febb15a63a
/*
Array object values are accessed with dot notation and array index: "offices.0.basicTitle"
This limits the preview to only select a subset of the array
https://www.sanity.io/docs/previews-list-views#62febb15a63a
*/
...[...Array(OFFICES_PREVIEW_ELLIPSIS_LIMIT).keys()].reduce(
(o, i) => ({ ...o, [`office${i}`]: `offices.${i}.basicTitle` }),
{},
Expand Down

0 comments on commit c148dd0

Please sign in to comment.