clentfort/urql-custom-scalars-exchange

Doesn't handle nested Fragments

Opened this issue ยท 3 comments

Many thanks for the repo! Still baffles me URQL and Apollo haven't got something like this natively...

A bug i've noticed is that this doesn't support nested Fragment's:
e.g.

query myQuery {
  object1 {
    fieldA,
    ...object1Fields
  }
}

fragment object1Fields on object1 {
  fieldB,
  object2 {
    ...object2Fields
  }
}

fragment object2Fields on object2 {
  fieldC,
}

fieldA and fieldB are mapped properly, but fieldC is ignored. Pulling the field out of the object2Fields fragment and putting it directly in to object1Fields does however work.
e.g.

query myQuery {
  object1 {
    fieldA,
    ...object1Fields
  }
}

fragment object1Fields on object1 {
  fieldB,
  object2 {
    fieldC
  }
}

Tried to fix it, but failed miserably - but at least I added test case. ๐Ÿ˜…

Implemented in #23.

The PR linked above is included in the fork available as @atmina/urql-custom-scalars-exchange@1.1.0 on NPM :)