Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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,
Expand Down
Loading