diff --git a/static/app/views/issueDetails/groupTags/tagDetailsDrawerContent.spec.tsx b/static/app/views/issueDetails/groupTags/tagDetailsDrawerContent.spec.tsx index 384db0225c935d..011d5318d810ee 100644 --- a/static/app/views/issueDetails/groupTags/tagDetailsDrawerContent.spec.tsx +++ b/static/app/views/issueDetails/groupTags/tagDetailsDrawerContent.spec.tsx @@ -1,4 +1,5 @@ import {GroupFixture} from 'sentry-fixture/group'; +import {OrganizationFixture} from 'sentry-fixture/organization'; import {TagsFixture} from 'sentry-fixture/tags'; import {TagValuesFixture} from 'sentry-fixture/tagvalues'; @@ -127,6 +128,41 @@ describe('TagDetailsDrawerContent', () => { }); }); + it('navigates to discover with issue + tag query', async () => { + const {router} = init('user'); + const discoverOrganization = OrganizationFixture({ + features: ['discover-basic'], + }); + + MockApiClient.addMockResponse({ + url: '/organizations/org-slug/issues/1/tags/user/values/', + body: TagValuesFixture(), + }); + render(, { + router, + organization: discoverOrganization, + }); + + await userEvent.click( + await screen.findByRole('button', {name: 'Tag Value Actions Menu'}) + ); + await userEvent.click(await screen.findByRole('link', {name: 'Open in Discover'})); + + expect(router.push).toHaveBeenCalledWith({ + pathname: '/organizations/org-slug/discover/results/', + query: { + dataset: 'errors', + field: ['title', 'release', 'environment', 'user.display', 'timestamp'], + interval: '4h', + name: 'RequestError: GET /issues/ 404', + project: '2', + query: 'issue:JAVASCRIPT-6QS user.username:david', + statsPeriod: '14d', + yAxis: ['count()', 'count_unique(user)'], + }, + }); + }); + it('renders an error message if tag values request fails', async () => { const {router} = init('user'); diff --git a/static/app/views/issueDetails/streamline/hooks/useIssueDetailsDiscoverQuery.tsx b/static/app/views/issueDetails/streamline/hooks/useIssueDetailsDiscoverQuery.tsx index d66664687e3166..c775710fc448b7 100644 --- a/static/app/views/issueDetails/streamline/hooks/useIssueDetailsDiscoverQuery.tsx +++ b/static/app/views/issueDetails/streamline/hooks/useIssueDetailsDiscoverQuery.tsx @@ -27,8 +27,8 @@ export function useIssueDetailsEventView({ const interval = getInterval(pageFilters.datetime, 'issues'); const config = getConfigForIssueType(group, group.project); - const query = [`issue:${group.shortId}`, searchQuery] - .filter(s => s.length > 0) + const query = [`issue:${group.shortId}`, searchQuery, queryProps?.query] + .filter(s => s && s.length > 0) .join(' '); const discoverQuery: NewQuery = {