Skip to content

Commit 7abbb94

Browse files
Fix Gateway / Playground Query Plan view (#3418)
This commit revisits recent changes from PR #3376 which broke Playground's ability to detect support for the Query Plan view. Playground's internals decide that QP is supported based on the response from the first introspection query. The previously mentioned PR broke this by not providing any response.extensions.__queryPlanExperimental at all. This makes sense for debug mode, but Playground still needs some form of hint to know that it's supported and continue sending the Apollo-Query-Plan-Experimental header.
1 parent faba52c commit 7abbb94

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

packages/apollo-gateway/CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
> The changes noted within this `vNEXT` section have not been released yet. New PRs and commits which introduce changes should include an entry in this `vNEXT` section as part of their development. When a release is being prepared, a new header will be (manually) created below and the the appropriate changes within that release will be moved into the new section.
66
7-
* _Nothing yet! Stay tuned!_
7+
* Fix Gateway / Playground Query Plan view [#3418](https://github.com/apollographql/apollo-server/pull/3418)
88

99
# v.0.10.7
1010

packages/apollo-gateway/src/index.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -539,11 +539,17 @@ export class ApolloGateway implements GraphQLService {
539539
this.logger.debug(serializedQueryPlan);
540540
}
541541

542-
if (shouldShowQueryPlan && serializedQueryPlan) {
542+
if (shouldShowQueryPlan) {
543543
// TODO: expose the query plan in a more flexible JSON format in the future
544544
// and rename this to `queryPlan`. Playground should cutover to use the new
545545
// option once we've built a way to print that representation.
546-
response.extensions = { __queryPlanExperimental: serializedQueryPlan };
546+
547+
// In the case that `serializedQueryPlan` is null (on introspection), we
548+
// still want to respond to Playground with something truthy since it depends
549+
// on this to decide that query plans are supported by this gateway.
550+
response.extensions = {
551+
__queryPlanExperimental: serializedQueryPlan || true,
552+
};
547553
}
548554
return response;
549555
};

0 commit comments

Comments
 (0)