Skip to content

Commit

Permalink
fix(insights): fix view all button to link from perf landing to insig…
Browse files Browse the repository at this point in the history
…hts (#78221)

fixes #78219

performance domain views are only under `/performance/<viewname>`, so we
can be more explicit here to prevent bugs.
  • Loading branch information
DominikB2014 authored Sep 26, 2024
1 parent bdd1cac commit 422ee35
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions static/app/views/insights/pages/useFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,24 @@ import type {ModuleName} from 'webpack-cli';

import {useLocation} from 'sentry/utils/useLocation';
import {useNavigate} from 'sentry/utils/useNavigate';
import type {AI_LANDING_SUB_PATH} from 'sentry/views/insights/pages/aiLandingPage';
import type {BACKEND_LANDING_SUB_PATH} from 'sentry/views/insights/pages/backendLandingPage';
import type {FRONTEND_LANDING_SUB_PATH} from 'sentry/views/insights/pages/frontend/settings';
import type {MOBILE_LANDING_SUB_PATH} from 'sentry/views/insights/pages/mobileLandingPage';
import {AI_LANDING_SUB_PATH} from 'sentry/views/insights/pages/aiLandingPage';
import {BACKEND_LANDING_SUB_PATH} from 'sentry/views/insights/pages/backendLandingPage';
import {FRONTEND_LANDING_SUB_PATH} from 'sentry/views/insights/pages/frontend/settings';
import {MOBILE_LANDING_SUB_PATH} from 'sentry/views/insights/pages/mobileLandingPage';

export type DomainView =
| typeof FRONTEND_LANDING_SUB_PATH
| typeof BACKEND_LANDING_SUB_PATH
| typeof AI_LANDING_SUB_PATH
| typeof MOBILE_LANDING_SUB_PATH;

const domainViews = [
FRONTEND_LANDING_SUB_PATH,
BACKEND_LANDING_SUB_PATH,
AI_LANDING_SUB_PATH,
MOBILE_LANDING_SUB_PATH,
];

export type DomainViewFilters = {
isInDomainView?: boolean;
view?: DomainView;
Expand All @@ -30,6 +37,9 @@ export const useDomainViewFilters = () => {
const isInDomainView = indexOfPerformance !== -1;

const view = pathSegments[indexOfPerformance + 1] as DomainViewFilters['view'];
if (!domainViews.includes(view || '')) {
return {isInDomainView: false};
}

if (isInDomainView) {
return {
Expand Down

0 comments on commit 422ee35

Please sign in to comment.