GraphQL API style guide > Mention frontend caveat when using the feature_flag property
Over the last months, there has been some confusion as to how a feature-flagged GraphQL entity can be queried from the frontend.
One source of confusion is that Apollo client provides a @include
and a @skip
directives that can be used to include/exclude an entity from a client-side query. We have deemed this as a way of handling feature flags in frontend queries as it makes it easy to omit fields from a query when a given feature flag is disabled.
However we have noticed that, no matter what the feature flag's state is, the guarded entity is always sent to the backend and matched against the schema. This leads to an edge-case where a client-side query might be trying to conditionally omit a field that leverages the feature_flag
property in the backend, which causes the query to error-out when the feature flag is off.
We have documented this edge-case in the frontend guidelines, but we likely need to surface this caveat in the backend guidelines as well.