How do i fix the error "unknown type "queryName" " on redwood js?

48 Views Asked by At

Using redwood JS framework, i'm trying to make queries to the database using graphQL. problem is that i get an error when i try to generate types :

Error 0: Unknown type "FindEditEventQueryVariables". at /home/alaborde/lisaquapp/app/web/src/components/EditEventCell/EditEventCell.tsx:1:47

it's crazy because i want to generate type for that BUT it doesn't wan't to generate because the type doesn't exist. it's an infinite loop. what should i do ?

i'm kinda new to the web dev world and i don't know a lot about queries.

Here's the code i wrote for this cell :

import type {
  FindEventListQuery,
  FindEventListQueryVariables,
} from 'types/graphql'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'
import EventList from '../EventList/EventList'

export const QUERY = gql`
  query FindEventListQuery($id: Int!) {
    event: event(typeId: $id) {
      id
      description
      criticalityId
      typeId
      idTank
      idWater
      idBatch
      createdAt
      createdBy
    }
  }
`

export const Loading = () => <div>Loading...</div>

export const Empty = () => <div>Empty</div>

export const Failure = ({
  error,
}: CellFailureProps<FindEventListQueryVariables>) => (
  <div style={{ color: 'red' }}>Error: {error?.message}</div>
)

export const Success = ({
  event,
}: CellSuccessProps<FindEventListQuery, FindEventListQueryVariables>) => {
  return (
    <EventList eventsList={event}/>
  )
}

i'll quickly explain what i want to achieve with this query :

I want to get all events which have the same TankId.

Any idea on what to do here ?

0

There are 0 best solutions below