Skip to content

Commit

Permalink
Pass loadContext through wrapped document request function
Browse files Browse the repository at this point in the history
Fixes issue #8265.
  • Loading branch information
dawnmist committed Jun 1, 2023
1 parent d5551aa commit b9943b8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/remix/src/utils/instrumentServer.ts
Expand Up @@ -113,14 +113,15 @@ function makeWrappedDocumentRequestFunction(
responseStatusCode: number,
responseHeaders: Headers,
context: Record<symbol, unknown>,
loadContext: Record<string, unknown>,
): Promise<Response> {
let res: Response;

const activeTransaction = getActiveTransaction();
const currentScope = getCurrentHub().getScope();

if (!currentScope) {
return origDocumentRequestFunction.call(this, request, responseStatusCode, responseHeaders, context);
return origDocumentRequestFunction.call(this, request, responseStatusCode, responseHeaders, context, loadContext);
}

try {
Expand All @@ -133,7 +134,7 @@ function makeWrappedDocumentRequestFunction(
},
});

res = await origDocumentRequestFunction.call(this, request, responseStatusCode, responseHeaders, context);
res = await origDocumentRequestFunction.call(this, request, responseStatusCode, responseHeaders, context, loadContext);

span?.finish();
} catch (err) {
Expand Down

0 comments on commit b9943b8

Please sign in to comment.