diff --git a/static/app/views/insights/pages/conversations/hooks/useConversation.spec.tsx b/static/app/views/insights/pages/conversations/hooks/useConversation.spec.tsx index 4d835c2367de..17933d91724f 100644 --- a/static/app/views/insights/pages/conversations/hooks/useConversation.spec.tsx +++ b/static/app/views/insights/pages/conversations/hooks/useConversation.spec.tsx @@ -228,16 +228,23 @@ describe('useConversation', () => { expect(result.current.isLoading).toBe(false); }); - // Verify the API was called with correct timestamps (with 1-hour padding) + // Verify the API was called with correct timestamps (with 1-hour padding), + // ALL_ACCESS_PROJECTS (-1) so it searches across all projects, + // and no environment filter so it searches across all environments expect(mockRequest).toHaveBeenCalledWith( expect.stringContaining('/ai-conversations/conv-timestamps/'), expect.objectContaining({ query: expect.objectContaining({ start: new Date(startTimestamp - 60 * 60 * 1000).toISOString(), end: new Date(endTimestamp + 60 * 60 * 1000).toISOString(), + project: [-1], }), }) ); + + // Ensure environment is not included in the query when using conversation timestamps + const queryArg = mockRequest.mock.calls[0]![1]!.query; + expect(queryArg).not.toHaveProperty('environment'); }); it('falls back to span.name when span.description is empty', async () => { diff --git a/static/app/views/insights/pages/conversations/hooks/useConversation.tsx b/static/app/views/insights/pages/conversations/hooks/useConversation.tsx index 829d2c249a38..3a39015fcb10 100644 --- a/static/app/views/insights/pages/conversations/hooks/useConversation.tsx +++ b/static/app/views/insights/pages/conversations/hooks/useConversation.tsx @@ -1,5 +1,6 @@ import {useEffect, useMemo} from 'react'; +import {ALL_ACCESS_PROJECTS} from 'sentry/components/pageFilters/constants'; import {normalizeDateTimeParams} from 'sentry/components/pageFilters/parse'; import {usePageFilters} from 'sentry/components/pageFilters/usePageFilters'; import {getApiUrl} from 'sentry/utils/api/getApiUrl'; @@ -193,10 +194,12 @@ export function useConversation( const hasConversationTimestamps = conversation.startTimestamp !== undefined && conversation.endTimestamp !== undefined; + // When conversation timestamps are provided (e.g. from a shared link), + // search across all projects and environments so the conversation is found + // regardless of which project/environment the page filter is currently set to. const queryParams = hasConversationTimestamps ? { - project: selection.projects, - environment: selection.environments, + project: [ALL_ACCESS_PROJECTS], start: new Date(conversation.startTimestamp! - ONE_HOUR_MS).toISOString(), end: new Date(conversation.endTimestamp! + ONE_HOUR_MS).toISOString(), per_page: 1000,