-
Notifications
You must be signed in to change notification settings - Fork 108
WriteQuery with enums seems unusable #210
Comments
Yes, this is exactly the problem I encountered. This is how I understand it, Simply fixing the type of So if you are using any directives in This is how I worked around the problem with cache in the example project in |
Thanks for confirming that. I ended up using an escape hatch solution like yours. |
Did you manage to serialize data when writing to cache? Could you maybe provide your solution? I am just curious, since I found a couple of different caveats in different situations requiring their own tweaks :) |
With this very unsafe and laborious escape hatch...
My version of graphql ppx doesn't add the __typename. |
When I try and use
WriteQuery
with an object that uses enums, it throws an error saying...Error: graphql_ppx: Expected enum value for X, got -260678070
Here is my code.
It seems that the signature of the
data
param onWriteQuery
is typed the same as the parsed ppx query, which is a ReasonML object type. When using enums, they are converted to Polymorphic Variants which look like numbers in JS. Obviously the types don't match the schema.As you can see, data is a Config.t.
The text was updated successfully, but these errors were encountered: