This content originally appeared on DEV Community and was authored by Shruti Pahuja
I have a requirement of adding a @include directive for querying a field in a particular fragment.
This fragment is being used across different queries in multiple modules so I'm having to inject a value for this field from each of these queries. I
Is there any way to assign a default value to a directive at the site of the directive?
fragment sampleFragment on SampleFragment {
// want to assign a default value here
fragmentSample @include(if: $condition) {
// code here
}
}
This content originally appeared on DEV Community and was authored by Shruti Pahuja

Shruti Pahuja | Sciencx (2024-09-20T11:36:17+00:00) Default value for field with @include directive. Retrieved from https://www.scien.cx/2024/09/20/default-value-for-field-with-include-directive/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.