Skip to content

Commit

Permalink
tidy up tsc errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dcousens committed Aug 20, 2024
1 parent 0501f3a commit 812dbc7
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions packages/core/src/fields/types/relationship/views/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@ import { Text } from '@keystar/ui/typography'
import { jsx, Stack, useTheme } from '@keystone-ui/core'
import { FieldDescription, FieldLegend } from '@keystone-ui/fields'
import { DrawerController } from '@keystone-ui/modals'
import {
type CellComponent,
type FieldController,
type FieldControllerConfig,
type FieldProps,
type ListMeta,
import type {
CellComponent,
FieldController,
FieldControllerConfig,
FieldProps,
ListMeta,
} from '../../../../types'
import { useKeystone, useList } from '../../../../admin-ui/context'
import { useList } from '../../../../admin-ui/context'
import { gql, useQuery } from '../../../../admin-ui/apollo'
import { CellContainer, CreateItemDrawer } from '../../../../admin-ui/components'

import { RelationshipSelect } from './RelationshipSelect'

export function Field (props: FieldProps<typeof controller>) {
const { field, value, itemValue, autoFocus, onChange, forceValidation } = props
const keystone = useKeystone()
const { field, value, autoFocus, onChange } = props
const foreignList = useList(field.refListKey)
const localList = useList(field.listKey)
const [isDrawerOpen, setIsDrawerOpen] = useState(false)
Expand Down Expand Up @@ -139,7 +138,7 @@ function ContextualActionsMenu (props: FieldProps<typeof controller>) {
const router = useRouter()
const foreignList = useList(field.refListKey)
const relatedItem = useRelatedItem(props)

const items = useMemo(() => {
let result = []
let allowCreate = !field.hideCreate && onChange !== undefined
Expand Down Expand Up @@ -519,19 +518,20 @@ export function controller (

function useRelationshipFilterValues ({ value, list }: { value: string, list: ListMeta }) {
const foreignIds = getForeignIds(value)
const where = { id: { in: foreignIds } }
const query = gql`
const { data, loading } = useQuery(gql`
query FOREIGNLIST_QUERY($where: ${list.graphql.names.whereInputName}!) {
items: ${list.graphql.names.listQueryName}(where: $where) {
id
${list.labelField}
}
}
`

const { data, loading } = useQuery(query, {
`, {
variables: {
where,
where: {
id: {
in: foreignIds
}
}
},
})

Expand Down

0 comments on commit 812dbc7

Please sign in to comment.