Skip to content

Nested Unions makes compiler hang #61

@mbirkegaard

Description

@mbirkegaard

I'm having an issue with GraphQL queries with nested unions causing the compiler to hang.

I'm trying to do something like the following

module Notifications = [%graphql {|
  query Notifications($limit: Int) {
  notifications(limit: $limit) {
    id
    createdAt {
      notification {
        ... on TypeA {
          aField
        }
        ... on TypeB {
          bField
          matches {
            ... on MatchC {
              cField
            }
            ... on MatchD {
              dField
            }
          }
        }
      }
    }
  }
}
|}];

If I remove the matches field, the query compiles in a few seconds (which seems a bit slow compared to normal).

I can't quite figure out whether this is an unsupported feature mentioned in the README but I wouldn't think so, given that it's normal unions of objects all the way down.

I wanted to try to diagnose it by setting the -verbose flag in bsconfig.json following the example given for -ast-out, but that just produced an error

Fatal error: exception Failure("graphql_ppx/ppx\\ -verbose not found when resolving ppx-flags")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions