@@ -803,7 +803,7 @@ fn execute_field(
803
803
& parents,
804
804
& join,
805
805
argument_values,
806
- sast:: is_list_or_non_null_list_field ( field_definition) ,
806
+ ! sast:: is_list_or_non_null_list_field ( field_definition) ,
807
807
ctx. query . schema . types_for_interface ( ) ,
808
808
resolver. block ,
809
809
ctx. max_first ,
@@ -812,28 +812,23 @@ fn execute_field(
812
812
}
813
813
814
814
/// Query child entities for `parents` from the store. The `join` indicates
815
- /// in which child field to look for the parent's id/join field
815
+ /// in which child field to look for the parent's id/join field. When
816
+ /// `is_single` is `true`, there is at most one child per parent.
816
817
fn fetch < S : Store > (
817
818
logger : Logger ,
818
819
store : & S ,
819
820
parents : & Vec < Node > ,
820
821
join : & Join < ' _ > ,
821
822
mut arguments : HashMap < & q:: Name , q:: Value > ,
822
- is_list : bool ,
823
+ is_single : bool ,
823
824
types_for_interface : & BTreeMap < s:: Name , Vec < s:: ObjectType > > ,
824
825
block : BlockNumber ,
825
826
max_first : u32 ,
826
827
) -> Result < Vec < Node > , QueryExecutionError > {
827
- if !arguments. contains_key ( & * ARG_FIRST ) {
828
- let first = if is_list {
829
- // This makes `build_range` use the default, 100
830
- q:: Value :: Null
831
- } else {
832
- // For non-list fields, get up to 2 entries so we can spot
833
- // ambiguous references that should only have one entry
834
- q:: Value :: Int ( 2 . into ( ) )
835
- } ;
836
- arguments. insert ( & * ARG_FIRST , first) ;
828
+ if is_single {
829
+ // For non-list fields, get up to 2 entries so we can spot
830
+ // ambiguous references that should only have one entry
831
+ arguments. insert ( & * ARG_FIRST , q:: Value :: Int ( 2 . into ( ) ) ) ;
837
832
}
838
833
839
834
if !arguments. contains_key ( & * ARG_SKIP ) {
@@ -849,7 +844,7 @@ fn fetch<S: Store>(
849
844
max_first,
850
845
) ?;
851
846
852
- if !is_list {
847
+ if is_single {
853
848
// Suppress 'order by' in lookups of scalar values since
854
849
// that causes unnecessary work in the database
855
850
query. order = EntityOrder :: Unordered ;
0 commit comments