Cell, multiple models, different components

This is almost like a mashup between two different issues

Issue

if I wanted to fetch multiple objects in the graphQl query and create a cell to do this i.e.

When generating a cell i.e. BoardOrganizationCell
perhaps the graphql looks similar to

export const QUERY = gql`
  query FindBoardOrganizationQuery(
    $orgRouteName: String!
    $boardRouteName: String!
  ) {
    board: board(routeName: $boardRouteName) {
      routeName
    }
    organization: organization(routeName: $orgRouteName) {
      routeName
    }
  }
`

in the CLI we’ll get

↓ Generating types ... [skipped]
    → Skipping type generation: no SDL defined for "BoardOrganization". To generate types, run 'yarn rw g sdl BoardOrganization'.

And so the type definition generated is broken

import type {
  FindBoardOrganizationQuery,
  FindBoardOrganizationQueryVariables,
} from 'types/graphql'
errors

What is the right way to deal with this?

Hi - first thing to check would be - does your SDL have the board and organization queries defined in your SDL?

I’m also sure why there’s two sets of inputs in your query - it may totally be valid syntax, just something I haven’t used or am not aware of.

What I would’ve done personally is:

  1. Define a query in board.sdl.ts
  type BoardOrg {
    board: Board!
    organization: Organization!
  }

  type Query {
    boardOrg(
    $orgRouteName: String!
    $boardRouteName: String!
    ): BoardOrg @requireAuth
  # ..... other queries ....

  1. Then write the query in your cell like this:
  query FindBoardOrganizationQuery(
    $orgRouteName: String!
    $boardRouteName: String!
  ) {
    boardOrg(boardRouteName: $boardRouteName, orgRouteName: $orgRouteName) {
      board {
       id
       routeName
       a
       b
      }
      organisation {
        id
        routeName
        x
        y
        z
      }
    }
  }