Skip to content

Commit

Permalink
Use root wrapper after loader wrapper to prevent multiple loader
Browse files Browse the repository at this point in the history
…spans.
  • Loading branch information
onurtemizkan committed Aug 3, 2022
1 parent c5d2c95 commit 019d791
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/remix/src/utils/instrumentServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ function makeWrappedCreateRequestHandler(
fill(wrappedRoute.module, 'action', makeWrappedAction);
}

if (wrappedRoute.module.loader) {
fill(wrappedRoute.module, 'loader', makeWrappedLoader);
}

// Entry module should have a loader function to provide `sentry-trace` and `baggage`
// They will be available for the root `meta` function as `data.sentryTrace` and `data.sentryBaggage`
if (!wrappedRoute.parentId) {
Expand All @@ -391,10 +395,6 @@ function makeWrappedCreateRequestHandler(
fill(wrappedRoute.module, 'loader', makeWrappedRootLoader);
}

if (wrappedRoute.module.loader) {
fill(wrappedRoute.module, 'loader', makeWrappedLoader);
}

routes[id] = wrappedRoute;
}

Expand Down

0 comments on commit 019d791

Please sign in to comment.