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 your feature request related to a problem? Please describe.
I have a couple of fields with optional input parameters that impact whether we want to cache the result. Basically, they use a user context if the input is provided, and we don't want to cache those results. Example:
typeShow {
id
title
featuredVideo(userId: UUID): Video
}
typeVideo {
id
title
}
typeQuery {
show(showId: UUID!): Show
}
For now we are just doing this to prevent caching if the field is requested at all (as we don't use sessions):
typeShow {
id
title
featuredVideo(userId: UUID): Video@cacheControl(scope: PRIVATE)
}
typeVideo {
id
title
}
typeQuery {
show(showId: UUID!): Show
}
Describe the solution you'd like
We could solve this use case if we had a way to apply cache control on ARGUMENT_DEFINITION. E.g. --
typeShow {
id
title
featuredVideo(
userId: UUID@cacheControl(scope: PRIVATE)
): Video
}
typeVideo {
id
title
}
typeQuery {
show(showId: UUID!): Show
}
I'm relatively new to working with GraphQL and I gather that schema coordinates are not really a clearly defined thing. I found this proposed syntax that could apply for this use case: Type.field(argName:).
Describe alternatives you've considered
I have tested using enabled to achieve this by looking at the entire query, but the signature is not async (enabled?: (request: Request) => boolean;) so I'm not able to get the query from the request body (though this doesn't seem like a great solution, anyway).
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I have a couple of fields with optional input parameters that impact whether we want to cache the result. Basically, they use a user context if the input is provided, and we don't want to cache those results. Example:
For this query, we want to cache the result:
But for this query we do not want to cache the result:
For now we are just doing this to prevent caching if the field is requested at all (as we don't use sessions):
Describe the solution you'd like
We could solve this use case if we had a way to apply cache control on
ARGUMENT_DEFINITION
. E.g. --I'm relatively new to working with GraphQL and I gather that schema coordinates are not really a clearly defined thing. I found this proposed syntax that could apply for this use case:
Type.field(argName:)
.Describe alternatives you've considered
I have tested using
enabled
to achieve this by looking at the entire query, but the signature is not async (enabled?: (request: Request) => boolean;
) so I'm not able to get the query from the request body (though this doesn't seem like a great solution, anyway).The text was updated successfully, but these errors were encountered: