Skip to content

Commit 71e0423

Browse files
committed
graphql: Put getting 'orderBy' field behind feature flag
1 parent 05bb095 commit 71e0423

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

graphql/src/store/prefetch.rs

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -909,30 +909,32 @@ fn collect_fields_inner<'a>(
909909
);
910910

911911
// Collect complementary fields used in the `orderBy` query attribute, if present.
912-
if let Some(arguments) = get_argument_value(&field.arguments, "orderBy") {
913-
let schema_field = type_condition.field(&field.name).expect(&format!(
914-
"the field {:?} to exist in {:?}",
915-
&field.name,
916-
&type_condition.name()
917-
));
918-
let field_name = sast::get_field_name(&schema_field.field_type);
919-
let object_or_interface_for_field = ctx
920-
.query
921-
.schema
922-
.document()
923-
.object_or_interface(&field_name)
924-
.expect(&format!(
925-
"The field {:?} to exist in the Document",
926-
field_name
912+
if !*DISABLE_EXPERIMENTAL_FEATURE_SELECT_BY_SPECIFIC_ATTRIBUTE_NAMES {
913+
if let Some(arguments) = get_argument_value(&field.arguments, "orderBy") {
914+
let schema_field = type_condition.field(&field.name).expect(&format!(
915+
"the field {:?} to exist in {:?}",
916+
&field.name,
917+
&type_condition.name()
927918
));
928-
match arguments {
929-
graphql_parser::schema::Value::Enum(complementary_field_name) => {
930-
complementary_fields.insert(
931-
object_or_interface_for_field,
932-
complementary_field_name.clone(),
933-
);
919+
let field_name = sast::get_field_name(&schema_field.field_type);
920+
let object_or_interface_for_field = ctx
921+
.query
922+
.schema
923+
.document()
924+
.object_or_interface(&field_name)
925+
.expect(&format!(
926+
"The field {:?} to exist in the Document",
927+
field_name
928+
));
929+
match arguments {
930+
graphql_parser::schema::Value::Enum(complementary_field_name) => {
931+
complementary_fields.insert(
932+
object_or_interface_for_field,
933+
complementary_field_name.clone(),
934+
);
935+
}
936+
_ => unimplemented!("unsure on what to do about other variants"),
934937
}
935-
_ => unimplemented!("unsure on what to do about other variants"),
936938
}
937939
}
938940
}

0 commit comments

Comments
 (0)