Skip to content

fix(analytics): strip leading colon from route params in Reload Analytics event keys#119483

Draft
billyvg wants to merge 1 commit into
masterfrom
claude/serene-cannon-x38v7j-frontend
Draft

fix(analytics): strip leading colon from route params in Reload Analytics event keys#119483
billyvg wants to merge 1 commit into
masterfrom
claude/serene-cannon-x38v7j-frontend

Conversation

@billyvg

@billyvg billyvg commented Jul 13, 2026

Copy link
Copy Markdown
Member

Problem

Sentry issue JAVASCRIPT-39C7 (SyntaxError: Invalid or unexpected token: /issues/:groupId/) was thrown from useRouteActivatedHook.tsx:60 on the issue detail page in customer-domain mode.

Root cause: convertToReloadPath in static/gsApp/utils/routeAnalytics.tsx preserved the leading : from route parameter segments. For the issue detail route /issues/:groupId/, the resulting Reload Analytics eventKey was page_view.issues.:group_id. The Reload Analytics library (window.ra.event()) throws a SyntaxError when it encounters .: because :identifier is not a valid JavaScript property name in dot-notation.

Why it surfaces on the issues route: groupDetails.tsx overrides the eventKey to issue_details.viewed via useRouteAnalyticsEventNames. However, the component is lazily loaded — if the user navigates away before the component mounts, _eventKey is still undefined and the fallback page_view.issues.:group_id is sent to Reload. Other routes that use the fallback pattern appear to not produce this error in practice.

Fix

Strip the leading : from each route parameter token in convertToReloadPath:

- .map(tok => tok.replace(/[\w ]+/g, snakeCase))
+ .map(tok => tok.replace(/^:/, '').replace(/[\w ]+/g, snakeCase))

This changes the output format from issues.:group_idissues.group_id, producing a valid dot-notation path that the Reload library can process without throwing.

Evidence

  • Sentry issue JAVASCRIPT-39C7: 2 occurrences, 2 users, status: regressed, handled: yes
  • Transaction: /issues/:groupId/ (customer domain)
  • Frame: useRouteActivatedHook.tsx:60:9 (callback)rawTrackAnalyticsEvent(
  • The error was caught by rawTrackAnalyticsEvent's try/catch but reported to Sentry via instrumented console.error

Changes

  • static/gsApp/utils/routeAnalytics.tsx — strip : prefix from parameter tokens in convertToReloadPath, update JSDoc example
  • static/gsApp/overrides/useRouteActivatedHook.spec.tsx — update expected eventKey/parameterized_path format; add regression test for issue detail route
  • static/gsApp/overrides/useButtonTracking.spec.tsx — update expected eventKey/parameterized_path format

Frontend-only change (backend fixes for other issues in PR #119482).

Session: https://claude.ai/code/session_0152iRwgLj2pwmC8VKUsxoKL

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.


Generated by Claude Code

…oadPath

Route parameter segments like ':groupId' were preserved with their leading colon
in the Reload Analytics eventKey (e.g. 'page_view.issues.:group_id'). The Reload
Analytics library throws a SyntaxError when it processes an eventKey containing
'.:' because `:identifier` is not a valid property name in dot-notation. This
caused JAVASCRIPT-39C7 on the issue detail page in customer-domain mode, where
the component is lazily loaded and the overridden eventKey may not be set before
the user navigates away.

The fix strips the leading ':' from each route parameter token in
convertToReloadPath, producing 'issues.group_id' instead of 'issues.:group_id'.
Updated all test assertions to reflect the new format and added a regression test
for the issue detail page route.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0152iRwgLj2pwmC8VKUsxoKL
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants