diff --git a/packages/solid/src/solidrouter.ts b/packages/solid/src/solidrouter.ts index a9e133da3a97..4f1a737485f8 100644 --- a/packages/solid/src/solidrouter.ts +++ b/packages/solid/src/solidrouter.ts @@ -18,12 +18,14 @@ import { import { NAVIGATION } from '@sentry/conventions/op'; import type { Client, Integration, Span } from '@sentry/core'; import { + createCachedRouteProvider, getClient, hasSpanStreamingEnabled, NAVIGATION_SPAN_NAME_FALLBACK, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, filterCollectedUrl, + setRouteProvider, } from '@sentry/core'; import type { BeforeLeaveEventArgs, @@ -40,6 +42,11 @@ import { createComponent } from 'solid-js/web'; const CLIENTS_WITH_INSTRUMENT_NAVIGATION = new WeakSet(); +// Solid Router only exposes matches through `useCurrentMatches()` inside a component, so there is no +// matcher the integration could call. The provider answers from patterns the router root has already +// reported instead. +const ROUTE_PROVIDER = createCachedRouteProvider(); + function locationToSpanUrlAttributes(pathname: string, search: string = '', hash: string = ''): Record { const pathWithSearch = `${pathname}${search}${hash}`; @@ -134,6 +141,7 @@ function withSentryRouterRoot(Root: Component): Component