Skip to content

Commit b0aa676

Browse files
committed
graphql: Simplify Join type in prefetch a little
1 parent a909d10 commit b0aa676

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

graphql/src/store/prefetch.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -366,25 +366,17 @@ impl<'a> Join<'a> {
366366
/// Construct a `Join` based on the parent field pointing to the child
367367
fn new(
368368
schema: &'a ApiSchema,
369-
parent_type: ObjectOrInterface<'a>,
369+
parent_type: &'a s::ObjectType,
370370
child_type: ObjectOrInterface<'a>,
371371
field_name: &str,
372372
) -> Self {
373-
let parent_types = parent_type
374-
.object_types(schema.schema())
375-
.expect("the name of the parent type is valid");
376373
let child_types = child_type
377374
.object_types(schema.schema())
378375
.expect("the name of the child type is valid");
379376

380-
let conds = parent_types
377+
let conds = child_types
381378
.iter()
382-
.flat_map::<Vec<_>, _>(|parent_type| {
383-
child_types
384-
.iter()
385-
.map(|child_type| JoinCond::new(parent_type, child_type, field_name))
386-
.collect()
387-
})
379+
.map(|child_type| JoinCond::new(parent_type, child_type, field_name))
388380
.collect();
389381

390382
Join { child_type, conds }
@@ -576,7 +568,7 @@ fn execute_selection_set<'a>(
576568

577569
let join = Join::new(
578570
ctx.query.schema.as_ref(),
579-
object_type.into(),
571+
object_type,
580572
child_type,
581573
&field.name,
582574
);

0 commit comments

Comments
 (0)