Skip to content

Commit

Permalink
fix(query-graphs): When eliminating suboptimal indirect paths, proper…
Browse files Browse the repository at this point in the history
…ly check for a direct `@key` edge (#3160)

This PR fixes a bug where when removing suboptimal indirect paths, we
didn't properly check for a direct `@key` edge at the end of the
potential direct path.

<!-- ROUTER-750 -->
  • Loading branch information
sachindshinde authored Oct 14, 2024
1 parent 8334c2a commit e00e1c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/orange-ears-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/query-graphs": patch
---

When eliminating suboptimal indirect paths during query planning, properly check for a direct `@key` edge at the end of the potential direct path.
2 changes: 1 addition & 1 deletion query-graphs-js/src/graphPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1586,7 +1586,7 @@ function advancePathWithNonCollectingAndTypePreservingTransitions<TTrigger, V ex
if (prevSubgraphVertex
&& (
backToPreviousSubgraph
|| hasValidDirectKeyEdge(toAdvance.graph, prevSubgraphVertex, edge.tail.source, conditionResolver, maxCost) != undefined
|| hasValidDirectKeyEdge(toAdvance.graph, prevSubgraphVertex, edge.tail.source, conditionResolver, maxCost)
)
) {
debug.groupEnd(
Expand Down

0 comments on commit e00e1c9

Please sign in to comment.