urql-custom-scalars-exchange icon indicating copy to clipboard operation
urql-custom-scalars-exchange copied to clipboard

Doesn't handle nested Fragments

Open francispoole opened this issue 3 years ago • 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
  }
}

francispoole avatar Dec 10 '21 14:12 francispoole

Tried to fix it, but failed miserably - but at least I added test case. :sweat_smile:

Warxcell avatar May 03 '22 10:05 Warxcell

Implemented in https://github.com/clentfort/urql-custom-scalars-exchange/pull/23.

DarryQueen avatar Nov 07 '22 21:11 DarryQueen