-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue where the query planner was incorrectly not querying `__typ…
…ename` in a subgraph fetch when `@interfaceObject` is involved (#2366) When we fetch data for abstract types (typically interface), we usually need to make sure that `__typename` is queried as the code that post-process responses may have to know the concrete type of an object in the response (to know if it should be included or not). There is a method that `__typename` for abstract types in fetch selections, but that method was not doing it for fragments for some reason (a oversight really). While this never created an issue before, this is now problematique in some case with `@interfaceObject` and so this commit ensure `__typename` is always added, even for fragments. Working on this issue, I also noticed that the part of the code that in the query planner that eliminates useless fetches (sometimes, due to how the query planner process work, some fetches are created but end up not querying anything useful (meaning that they only query things already queried)) had not been updated for `@interfaceObject` and was not doing its job in some case. This lead to query plans including unecessary fetches (which can have a non-negligible impact). This commit also fix that issue.
- Loading branch information
Sylvain Lebresne
committed
Feb 3, 2023
1 parent
7e2ca46
commit eb5a8bc
Showing
6 changed files
with
381 additions
and
3 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,7 @@ | ||
--- | ||
"@apollo/gateway": patch | ||
"@apollo/query-planner": patch | ||
--- | ||
|
||
Fix issue where the query planner was incorrectly not querying `__typename` in a subgraph fetch when `@interfaceObject` is involved | ||
|
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
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
Oops, something went wrong.