Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import {
updateSpanName,
filterCollectedUrl,
} from '@sentry/core';
import type { ClientInstrumentation } from 'react-router';
import { DEBUG_BUILD } from '../common/debug-build';
import type { ClientInstrumentation, InstrumentableRoute, InstrumentableRouter } from '../common/types';
Comment thread
logaretm marked this conversation as resolved.
import { captureInstrumentationError, getPathFromRequest, getPattern, normalizeRoutePath } from '../common/utils';
import {
resolveNavigateAbsoluteUrl,
Expand Down Expand Up @@ -72,7 +72,7 @@ export function createSentryClientInstrumentation(
DEBUG_BUILD && debug.log('React Router client instrumentation API created.');

return {
router(router: InstrumentableRouter) {
router(router) {
// Set the flag when React Router actually invokes our instrumentation.
// This ensures the flag is only set in Library Mode (where hooks run),
// not in Framework Mode (where hooks are never called).
Expand Down Expand Up @@ -242,7 +242,7 @@ export function createSentryClientInstrumentation(
});
},

route(route: InstrumentableRoute) {
route(route) {
const routeId = route.id;

route.instrument({
Expand Down
2 changes: 1 addition & 1 deletion packages/react-router/src/client/tracingIntegration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { browserTracingIntegration as originalBrowserTracingIntegration } from '@sentry/browser';
import type { Integration } from '@sentry/core';
import type { ClientInstrumentation } from '../common/types';
import type { ClientInstrumentation } from 'react-router';
import {
createSentryClientInstrumentation,
type CreateSentryClientInstrumentationOptions,
Expand Down
94 changes: 0 additions & 94 deletions packages/react-router/src/common/types.ts

This file was deleted.

3 changes: 1 addition & 2 deletions packages/react-router/src/common/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { captureException, debug } from '@sentry/core';
import { DEBUG_BUILD } from './debug-build';
import type { InstrumentationResult } from './types';

/**
* Extracts pathname from request URL.
Expand Down Expand Up @@ -44,7 +43,7 @@ export function normalizeRoutePath(pattern?: string): string | undefined {
* Caller must verify result contains an Error before calling.
*/
export function captureInstrumentationError(
result: InstrumentationResult,
result: { error: unknown },
captureErrors: boolean,
mechanismType: string,
data: Record<string, string | boolean>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import {
updateSpanName,
filterCollectedUrl,
} from '@sentry/core';
import type { ServerInstrumentation } from 'react-router';
import { DEBUG_BUILD } from '../common/debug-build';
import type { InstrumentableRequestHandler, InstrumentableRoute, ServerInstrumentation } from '../common/types';
import { captureInstrumentationError, getPathFromRequest, getPattern, normalizeRoutePath } from '../common/utils';
import { getMiddlewareName } from './serverBuild';
import { markInstrumentationApiUsed } from './serverGlobals';
Expand Down Expand Up @@ -58,7 +58,7 @@ export function createSentryServerInstrumentation(
DEBUG_BUILD && debug.log('React Router server instrumentation created.');

return {
handler(handler: InstrumentableRequestHandler) {
handler(handler) {
// Mark the instrumentation API active only when React Router actually invokes this
markInstrumentationApiUsed();
handler.instrument({
Expand Down Expand Up @@ -123,7 +123,7 @@ export function createSentryServerInstrumentation(
});
},

route(route: InstrumentableRoute) {
route(route) {
// Also mark active here, in case route registration runs (mirrors the handler callback above).
markInstrumentationApiUsed();
const routeId = route.id;
Expand Down
Loading