fix(command-palette): Preserve orgId in settings navigation URLs - #123699
Draft
sentry[bot] wants to merge 2 commits into
Draft
fix(command-palette): Preserve orgId in settings navigation URLs#123699sentry[bot] wants to merge 2 commits into
sentry[bot] wants to merge 2 commits into
Conversation
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.
This PR fixes a "Route not found" error when navigating to organization-level settings pages (e.g., Feature Flags) via the command palette, specifically for organizations configured with customer domains.
Root Cause:
When a user searched for a setting (e.g., "new provider" for Feature Flags) from a user-level settings page (e.g.,
/settings/account/details/), theSettingsCommandPaletteActionscomponent would correctly resolve the URL to include the organization slug (e.g.,/settings/doogi/feature-flags/change-tracking/new-provider/). However, theCommandPalettecomponent (incommandPalette.tsx) would then applynormalizeUrl()to this already-resolved path. For customer-domain enabled organizations,normalizeUrl()contains a pattern that incorrectly stripped the real organization slug (e.g.,doogi) from the path, resulting in a URL like/settings/feature-flags/change-tracking/new-provider/. The router would then fail to match this route, interpretingfeature-flagsas the:orgIdparameter.Fix:
The
normalizeUrl()function is now applied earlier inSettingsCommandPaletteActionswithin theresolveRoutePathfunction. It is applied to the route template before the actual organization slug is substituted. This ensures that:normalizeUrl()strips the:orgIdplaceholder from the template (e.g.,/settings/:orgId/feature-flags/...becomes/settings/feature-flags/...). The subsequentreplaceRouterParamscall then becomes a no-op for the:orgIdpart, and the URL is already in its canonical form.normalizeUrl()acts as a no-op on the template, and the organization slug is correctly substituted as before.This change makes the URL canonical before it is passed to the command palette, ensuring that the subsequent
normalizeUrl()call in the command palette is idempotent and does not alter the path incorrectly.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.
Fixes JAVASCRIPT-39JT
@sentry <feedback>: Autofix iterates on these changes@sentry stop iterating: Autofix stops iterating on this runThis PR was automatically generated by Sentry. You can adjust this setting at any time.