Skip to content

Mutation results don't include FieldPolicy changes #7665

Closed
@stephenh

Description

@stephenh

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions