Dynamically generated gql queries with Apollo Hooks

Hello,
I have a question about dynamically generated graphQL queries. When I pass them into hooks like useQuery. If the query is undefined I can choose to skip the fetch but the hook hook still errors. The solution I have found is to pass a dummy_query to return instead of undefined. Is there a more elegant solution or am I doing this wrong>?


// dummy query to prevent apollo client from throwing an error and the app from crashing
export const DUMMY_QUERY = gql`
  query {
    __typename # This is a special name in GraphQL for introspection queries
  }
`