fix(analytics): strip leading colon from route params in Reload Analytics event keys#119483
Draft
billyvg wants to merge 1 commit into
Draft
fix(analytics): strip leading colon from route params in Reload Analytics event keys#119483billyvg wants to merge 1 commit into
billyvg wants to merge 1 commit into
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Sentry issue JAVASCRIPT-39C7 (
SyntaxError: Invalid or unexpected token: /issues/:groupId/) was thrown fromuseRouteActivatedHook.tsx:60on the issue detail page in customer-domain mode.Root cause:
convertToReloadPathinstatic/gsApp/utils/routeAnalytics.tsxpreserved the leading:from route parameter segments. For the issue detail route/issues/:groupId/, the resulting Reload Analytics eventKey waspage_view.issues.:group_id. The Reload Analytics library (window.ra.event()) throws aSyntaxErrorwhen it encounters.:because:identifieris not a valid JavaScript property name in dot-notation.Why it surfaces on the issues route:
groupDetails.tsxoverrides the eventKey toissue_details.viewedviauseRouteAnalyticsEventNames. However, the component is lazily loaded — if the user navigates away before the component mounts,_eventKeyis stillundefinedand the fallbackpage_view.issues.:group_idis 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 inconvertToReloadPath:This changes the output format from
issues.:group_id→issues.group_id, producing a valid dot-notation path that the Reload library can process without throwing.Evidence
handled: yes/issues/:groupId/(customer domain)useRouteActivatedHook.tsx:60:9 (callback)→rawTrackAnalyticsEvent(rawTrackAnalyticsEvent's try/catch but reported to Sentry via instrumentedconsole.errorChanges
static/gsApp/utils/routeAnalytics.tsx— strip:prefix from parameter tokens inconvertToReloadPath, update JSDoc examplestatic/gsApp/overrides/useRouteActivatedHook.spec.tsx— update expected eventKey/parameterized_path format; add regression test for issue detail routestatic/gsApp/overrides/useButtonTracking.spec.tsx— update expected eventKey/parameterized_path formatFrontend-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