From 0ad5161758d8bb59c2fb372916e8de5f8f8850ec 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 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