@@ -89,23 +89,8 @@ function cancelScheduledCallback(id: number): void {
8989}
9090
9191/**
92- * Computes a location key that uniquely identifies a navigation including pathname, search, and hash.
93- *
94- * Normalizes undefined/null search and hash to empty strings to ensure consistency between
95- * partial location objects (from <Routes location="/path">) and full location objects
96- * (from history state). This prevents duplicate navigation spans when using the location
97- * prop with string values (common in modal routes and SSR).
98- *
92+ * Computes location key for duplicate detection. Normalizes undefined/null to empty strings.
9993 * Exported for testing.
100- *
101- * @example
102- * // Partial location (from <Routes location="/users">)
103- * computeLocationKey({ pathname: '/users', search: undefined, hash: undefined })
104- * // Returns: '/users'
105- *
106- * // Full location (from history)
107- * computeLocationKey({ pathname: '/users', search: '', hash: '' })
108- * // Returns: '/users' (same key - duplicate detection works correctly)
10994 */
11095export function computeLocationKey ( location : Location ) : string {
11196 return `${ location . pathname } ${ location . search || '' } ${ location . hash || '' } ` ;
@@ -807,6 +792,11 @@ export function handleNavigation(opts: {
807792 const oldName = trackedNav . routeName ;
808793 trackedNav . span . updateName ( name ) ;
809794 trackedNav . span . setAttribute ( SEMANTIC_ATTRIBUTE_SENTRY_SOURCE , source as 'route' | 'url' | 'custom' ) ;
795+ addNonEnumerableProperty (
796+ trackedNav . span as { __sentry_navigation_name_set__ ?: boolean } ,
797+ '__sentry_navigation_name_set__' ,
798+ true ,
799+ ) ;
810800 trackedNav . routeName = name ;
811801 DEBUG_BUILD && debug . log ( `[Tracing] Updated navigation span name from "${ oldName } " to "${ name } "` ) ;
812802 } else {
0 commit comments