Skip to content

Commit

Permalink
Fix relationship fields with displayMode: 'cards' not using labels …
Browse files Browse the repository at this point in the history
…in the Cell component (keystonejs#6041)
  • Loading branch information
emmatown authored and Nikitoring committed Sep 13, 2021
1 parent 5bf666f commit 9a891ce
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/wise-news-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/fields': patch
---

Fixed `relationship` field with `displayMode: 'cards'` not using labels for related items in the cell view.
1 change: 1 addition & 0 deletions packages-next/fields/src/types/relationship/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export const relationship =
inlineCreate: config.ui.inlineCreate ?? null,
inlineEdit: config.ui.inlineEdit ?? null,
inlineConnect: config.ui.inlineConnect ?? false,
refLabelField: adminMetaRoot.listsByKey[foreignListKey].labelField,
}
: config.ui?.displayMode === 'count'
? { displayMode: 'count' }
Expand Down
2 changes: 2 additions & 0 deletions packages-next/fields/src/types/relationship/views/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ export const controller = (
inlineCreate: { fields: string[] } | null;
inlineEdit: { fields: string[] } | null;
inlineConnect: boolean;
refLabelField: string;
}
| { displayMode: 'count' }
)
Expand Down Expand Up @@ -418,6 +419,7 @@ export const controller = (
`${config.path}__id: id
${config.path} {
id
label: ${config.fieldMeta.refLabelField}
}`
: config.fieldMeta.displayMode === 'count'
? `_${config.path}Meta {count}`
Expand Down

0 comments on commit 9a891ce

Please sign in to comment.