rescript-relay
rescript-relay copied to clipboard
Consider hiding `.use` on `@inline` fragments
Relay doesn't seem to handle InlineFrag.use(frag) well if the fragment module InlineFrag has the @inline directive.
A strange error is thrown that makes finding the cause difficult, especially for new people.
This seems like a bug and has been an issue for longer that the linked to issue has been open.
Here is an example of the error:
Uncaught Invariant Violation: GraphQLTag: Expected a fragment, got `{"kind":"InlineDataFragment","name":"ContractSharedBookingByDateFrag"}`.
invariant browser.js:38
getFragment GraphQLTag.js:37
useFragment_LEGACY useFragment.js:14
useFragment useFragment.js:31
useFragment2 RescriptRelay_Fragment.bs.js:10
use$9 Contract_Shared.bs.js:298
I'm guessing this PPX code would have to be guarded by !hasInlineDirective.
Definitely a good idea to hide. Do you want to take a stab at fixing it?
I opened a PR https://github.com/zth/rescript-relay/pull/507