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 (#6041)
  • Loading branch information
emmatown committed Jul 1, 2021
1 parent f6f77e4 commit c536b47
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

1 comment on commit c536b47

@vercel
Copy link

@vercel vercel bot commented on c536b47 Jul 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.