From c5ddd3377a9dddff4ec434649a5061e8a03f31bf Mon Sep 17 00:00:00 2001 From: Abdelrahman Awad Date: Mon, 24 Aug 2026 16:09:07 -0400 Subject: [PATCH] feat(solid): Register a route provider backed by reported route patterns Solid Router only exposes matches through `useCurrentMatches()` inside a component, so there is no matcher the integration can call. The router root already resolves the pattern to rename the span, so it records it on the way through and the provider answers from that. --- packages/solid/src/solidrouter.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/solid/src/solidrouter.ts b/packages/solid/src/solidrouter.ts index 564e1e9b70ac..090a3cc62e84 100644 --- a/packages/solid/src/solidrouter.ts +++ b/packages/solid/src/solidrouter.ts @@ -15,11 +15,13 @@ import { } from '@sentry/conventions/attributes'; import type { Client, Integration, Span } from '@sentry/core'; import { + createCachedRouteProvider, getClient, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, filterCollectedUrl, + setRouteProvider, } from '@sentry/core'; import type { BeforeLeaveEventArgs, @@ -36,6 +38,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}`; @@ -129,6 +136,7 @@ function withSentryRouterRoot(Root: Component): Component