-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix relative path logic when eliding subgraph jump for
@fromContext
(…
…#3005) This PR makes some changes to #2988, specifically: - It fixes a bug where the relative path is computed incorrectly when a subgraph jump is skipped/elided in the case of `@fromContext`. - It changes the selection-set-to-renamer conversion logic to create multiple inline fragments instead of introducing a new syntax, in the case of a type condition on an abstract type. (This saves us from having to update router to understand it.) - It tweaks the iteration over the `GraphPath` in `canSatisfyConditions()` to be cleaner/easier to understand. - When I looked at that code again, I noticed it was strange that we initialized `levelsInDataPath` at `1` even though we aren't guaranteed that the last element in `GraphPath` is a field. The gist is that at the first match, we know it's a field, so that ends up being okay. But I think it's easier to understand code-wise if both `levelsInQueryPath` and `levelsInDataPath` start off at 0, and every time we get a new element (at the start of the `for` block) we increment the counts accordingly.
- Loading branch information
1 parent
0bed4d1
commit b0ef55f
Showing
4 changed files
with
23 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@apollo/query-planner": patch | ||
--- | ||
|
||
Fix relative path logic when eliding subgraph jumps for `@fromContext` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters