Description
I'm using a FieldPolicy
to translate a custom Date
scalar from strings like "2020-01-01"
on the wire to a CalendarDate
type for the application code to consume.
Basically as a solution to this long-standing feature request:
https://github.com/apollographql/apollo-feature-requests/issues/2
The FieldPolicy
approach has been working great for regular queries, but if I invoke a mutation that, as part of the mutation response payload, returns a Date
scalar, my application gets back the "just a string" date and blows up b/c it was expecting a CalendarDate
.
Fwiw I can see, via debug points, that the FieldPolicy
is being invoked while the mutation results are written to the cache, but the storeResult
returned from QueryManager.mutate
is the still as-returned-by-the-link-layer result, i.e. with the string dates.
Is this an intentional limitation of FieldPolicy
, or should mutation results include the "post-FieldPolicy
" changes?
Activity