Skip to content

Commit f3f43a1

Browse files
committed
rootvalue execution request
1 parent a165a2f commit f3f43a1

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

packages/fusion-runtime/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ export function wrapExecutorWithHooks({
300300
baseExecutionRequest.info =
301301
baseExecutionRequest.info || ({} as GraphQLResolveInfo);
302302
baseExecutionRequest.info.executionRequest = baseExecutionRequest;
303-
// TODO: Fix this in onFetch hook handler of @graphql-mesh/utils
303+
// this rootValue will be set in the info value for field.resolvers in non-graphql requests
304304
// TODO: Also consider if a subgraph can ever rely on the gateway's rootValue?
305305
baseExecutionRequest.rootValue = {
306306
executionRequest: baseExecutionRequest,

packages/runtime/src/plugins/useUpstreamRetry.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,8 @@ export function useUpstreamRetry<TContext extends Record<string, any>>(
182182
}
183183
}
184184
},
185-
onFetch({ info, executionRequest }) {
186-
// if there's no execution request, it's a subgraph request
185+
onFetch({ executionRequest }) {
187186
// TODO: Also consider what happens when there are multiple fetch calls for a single subgraph request
188-
// @ts-expect-error - we know that it might have executionRequest property
189-
executionRequest ||= info?.rootValue?.executionRequest;
190187
if (executionRequest) {
191188
return function onFetchDone({ response }) {
192189
executionRequestResponseMap.set(executionRequest, response);

packages/runtime/src/wrapFetchWithHooks.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ export function wrapFetchWithHooks<TContext>(
4545
// @ts-expect-error TODO: why?
4646
info,
4747
get executionRequest() {
48-
return info?.executionRequest;
48+
return (
49+
info?.executionRequest ||
50+
// @ts-expect-error might be in the root value, see packages/fusion-runtime/src/utils.ts
51+
info?.rootValue?.executionRequest
52+
);
4953
},
5054
endResponse(newResponse) {
5155
response$ = newResponse;

0 commit comments

Comments
 (0)