Skip to content

Commit

Permalink
Update list ui config types to accept id field (#6249)
Browse files Browse the repository at this point in the history
  • Loading branch information
timleslie authored Aug 3, 2021
1 parent 91d7b2c commit 8187ea0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/tough-geese-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/types': patch
---

Updated types to allow the `'id'` field in `ui.labelField`, `ui.listView.initialColumns`, and `ui.listView.initialSort`.
6 changes: 3 additions & 3 deletions packages/types/src/config/lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export type ListAdminUIConfig<
* The field to use as a label in the Admin UI. If you want to base the label off more than a single field, use a virtual field and reference that field here.
* @default 'label', if it exists, falling back to 'name', then 'title', and finally 'id', which is guaranteed to exist.
*/
labelField?: keyof Fields;
labelField?: 'id' | keyof Fields;
/**
* The fields used by the Admin UI when searching this list.
* It is always possible to search by id and `id` should not be specified in this option.
Expand Down Expand Up @@ -157,9 +157,9 @@ export type ListAdminUIConfig<
* Users of the Admin UI can select different columns to show in the UI.
* @default the first three fields in the list
*/
initialColumns?: (keyof Fields)[];
initialColumns?: ('id' | keyof Fields)[];
// was previously top-level defaultSort
initialSort?: { field: keyof Fields; direction: 'ASC' | 'DESC' };
initialSort?: { field: 'id' | keyof Fields; direction: 'ASC' | 'DESC' };
// was previously defaultPageSize
pageSize?: number; // default number of items to display per page on the list screen
// note: we are removing maximumPageSize
Expand Down

1 comment on commit 8187ea0

@vercel
Copy link

@vercel vercel bot commented on 8187ea0 Aug 3, 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.