File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
packages/core/src/fields/types/virtual Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -42,19 +42,19 @@ export type VirtualFieldConfig<ListTypeInfo extends BaseListTypeInfo> =
4242 }
4343 }
4444
45- export const virtual =
46- < ListTypeInfo extends BaseListTypeInfo > ( {
47- field,
48- ...config
49- } : VirtualFieldConfig < ListTypeInfo > ) : FieldTypeFunc < ListTypeInfo > =>
50- meta => {
45+ export function virtual < ListTypeInfo extends BaseListTypeInfo > ( {
46+ field,
47+ ...config
48+ } : VirtualFieldConfig < ListTypeInfo > ) : FieldTypeFunc < ListTypeInfo > {
49+ return ( meta ) => {
5150 const usableField = typeof field === 'function' ? field ( meta . lists ) : field
5251 const namedType = getNamedType ( usableField . type . graphQLType )
5352 const hasRequiredArgs =
5453 usableField . args &&
5554 Object . values (
5655 usableField . args as Record < string , graphql . Arg < graphql . InputType , boolean > >
5756 ) . some ( x => x . type . kind === 'non-null' && x . defaultValue === undefined )
57+
5858 if (
5959 ( ! isLeafType ( namedType ) || hasRequiredArgs ) &&
6060 ! config . ui ?. query &&
@@ -73,9 +73,8 @@ export const virtual =
7373 `}`
7474 )
7575 }
76- return fieldType ( {
77- kind : 'none' ,
78- } ) ( {
76+
77+ return fieldType ( { kind : 'none' , } ) ( {
7978 ...config ,
8079 output : graphql . field ( {
8180 ...( usableField as any ) ,
@@ -85,6 +84,9 @@ export const virtual =
8584 } ) ,
8685 __ksTelemetryFieldTypeName : '@keystone-6/virtual' ,
8786 views : '@keystone-6/core/fields/types/virtual/views' ,
88- getAdminMeta : ( ) => ( { query : config . ui ?. query || '' } ) ,
87+ getAdminMeta : ( ) => ( {
88+ query : config . ui ?. query || ''
89+ } ) ,
8990 } )
9091 }
92+ }
You can’t perform that action at this time.
0 commit comments