You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there an existing issue that is already proposing this?
I have searched the existing issues
Is your feature request related to a problem? Please describe it
Many people over many years have requested having the Root Query type to be exported to be able to use the technique of Mutation Payload Query, like so https://graphql-rules.com/rules/mutation-payload-query/, in which you return the whole Root Query type to allow the client to get the whatever data they want.
Describe the solution you'd like
For a mutation PollRatingSubmit, having a payload:
@ObjectType()
export class PollRatingSubmitPayload {
userErrors: UserErrorDto[];
query: QueryDto;
}
What is the motivation / use case for changing the behavior?
As put in the linked 'rules' site, "... allow the client in one round-trip not only to call mutation but also to get a wagon of data to update their application." I'm using Relay GQL client which will allow me to simply spread their fragments in the Query payload and update the cache and UI whenever some of my mutations have effects on rather less relevant parts of the graph.
Personally I already tried to implement this one year ago or so but couldn't, I might try it when I have some time, but ideas on how to implement this would be helpful, for both code-first and schema-first.
Activity
avedetvedea commentedon Mar 23, 2023
related just by searching the link I provided in the Discord search (excluding mine):
https://discord.com/channels/520622812742811698/601536926268260392/740208115802439808
https://discord.com/channels/520622812742811698/601536926268260392/894303708500877332
https://discord.com/channels/520622812742811698/601536926268260392/903086776296538143
https://discord.com/channels/520622812742811698/601536926268260392/916777645260304455
https://discord.com/channels/520622812742811698/601536926268260392/961307042419724318
https://discord.com/channels/520622812742811698/601536926268260392/961383045993218128
https://discord.com/channels/520622812742811698/601536926268260392/962204320533741649
https://discord.com/channels/520622812742811698/601536926268260392/980417580483362836
tugascript commentedon Mar 25, 2023
I know I am being a broken clock here, always touching the same thing, but could you try to create a Draft PR for this?
The field decorator would be here: https://github.com/nestjs/graphql/blob/master/packages/graphql/lib/decorators/field.decorator.ts
Definitions (on the Apollo Driver) are generated here: https://github.com/nestjs/graphql/blob/master/packages/apollo/lib/drivers/apollo.driver.ts#L30
Personally I already tried to implement this one year ago or so but couldn't, I might try it when I have some time, but ideas on how to implement this would be helpful, for both code-first and schema-first.
feat(graphql): allow fields to reference the root query type (nestjs#…