Skip to content

Commit 2fc1398

Browse files
Revert "fix(domains) Remove usage or params.orgId in search (#43205)"
This reverts commit 262099c. Co-authored-by: markstory <[email protected]>
1 parent 8b4181c commit 2fc1398

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

static/app/components/search/list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const ResultRow = memo(
120120
...renderItemProps
121121
}: SearchItemProps) => {
122122
const {item, index} = renderItemProps;
123-
useEffect(() => registerVisibleItem(index, item), [registerVisibleItem, index, item]);
123+
useEffect(() => registerVisibleItem(index, item), [registerVisibleItem, item]);
124124

125125
const itemProps = useMemo(
126126
() => getItemProps({item, index}),

static/app/components/search/searchResult.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {IconInput, IconLink, IconSettings} from 'sentry/icons';
88
import PluginIcon from 'sentry/plugins/components/pluginIcon';
99
import space from 'sentry/styles/space';
1010
import highlightFuseMatches from 'sentry/utils/highlightFuseMatches';
11-
import useOrganization from 'sentry/utils/useOrganization';
11+
import {useParams} from 'sentry/utils/useParams';
1212

1313
import {Result} from './sources/types';
1414

@@ -38,7 +38,7 @@ function renderResultType({resultType, model}: Result['item']) {
3838
}
3939

4040
function SearchResult({item, matches, highlighted}: Props) {
41-
const organization = useOrganization();
41+
const params = useParams<{orgId: string}>();
4242

4343
const {sourceType, model, extra} = item;
4444

@@ -73,7 +73,7 @@ function SearchResult({item, matches, highlighted}: Props) {
7373
displayEmail: DescriptionNode,
7474
description: DescriptionNode,
7575
useLink: false,
76-
orgId: organization.slug,
76+
orgId: params.orgId,
7777
avatarSize: 32,
7878
[sourceType]: model,
7979
};

static/app/components/search/sources/apiSource.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('ApiSource', function () {
2121
router,
2222
location: router.location,
2323
routes: [],
24-
params: {},
24+
params: {orgId: org.slug},
2525
children: jest.fn().mockReturnValue(null),
2626
};
2727

static/app/components/search/sources/apiSource.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ async function createEventIdLookupResult(
271271
};
272272
}
273273

274-
type Props = WithRouterProps<{}> & {
274+
type Props = WithRouterProps<{orgId: string}> & {
275275
children: (props: ChildProps) => React.ReactElement;
276276
/**
277277
* search term
@@ -330,8 +330,8 @@ class ApiSource extends Component<Props, State> {
330330

331331
// Debounced method to handle querying all API endpoints (when necessary)
332332
doSearch = debounce((query: string) => {
333-
const {organization} = this.props;
334-
const orgId = organization?.slug;
333+
const {params, organization} = this.props;
334+
const orgId = (params && params.orgId) || (organization && organization.slug);
335335

336336
let searchUrls = ['/organizations/'];
337337
let directUrls: (string | null)[] = [];
@@ -458,10 +458,9 @@ class ApiSource extends Component<Props, State> {
458458
}
459459

460460
// Process API requests that create result objects that should be searchable
461-
async getSearchableResults(requests: Promise<any>[]) {
462-
const {organization} = this.props;
463-
const orgId = organization?.slug;
464-
461+
async getSearchableResults(requests) {
462+
const {params, organization} = this.props;
463+
const orgId = (params && params.orgId) || (organization && organization.slug);
465464
const [
466465
organizations,
467466
projects,

static/app/components/search/sources/formSource.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import withSentryRouter from 'sentry/utils/withSentryRouter';
1111
import {ChildProps, Result, ResultItem} from './types';
1212
import {strGetFn} from './utils';
1313

14-
type Props = WithRouterProps<{}> & {
14+
type Props = WithRouterProps<{orgId: string}> & {
1515
children: (props: ChildProps) => React.ReactElement;
1616
/**
1717
* search term

0 commit comments

Comments
 (0)