Skip to content
Merged
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
18 changes: 15 additions & 3 deletions static/app/views/insights/agents/views/overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {t} from 'sentry/locale';
import {trackAnalytics} from 'sentry/utils/analytics';
import {getSelectedProjectList} from 'sentry/utils/project/useSelectedProjectsHaveField';
import {decodeScalar} from 'sentry/utils/queryString';
import {useLocation} from 'sentry/utils/useLocation';
import useOrganization from 'sentry/utils/useOrganization';
import usePageFilters from 'sentry/utils/usePageFilters';
import useProjects from 'sentry/utils/useProjects';
Expand Down Expand Up @@ -74,6 +75,7 @@ function AgentsOverviewPage() {
const datePageFilterProps = limitMaxPickableDays(organization);
const [searchQuery, setSearchQuery] = useLocationSyncedState('query', decodeScalar);
useDefaultToAllProjects();
const location = useLocation();

const {activeTable, onActiveTableChange} = useActiveTable();

Expand Down Expand Up @@ -153,6 +155,11 @@ function AgentsOverviewPage() {
? undefined
: agentRunsRequest.data?.length > 0;

const resetParamsOnChange = useMemo(
() => Object.keys(location.query).filter(key => key.toLowerCase().includes('cursor')),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of this matching. Why don't we just use the same cursor name for all tables and reset that one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of this matching. Why don't we just use the same cursor name for all tables and reset that one?

i agree with you but we have many different cursor names, like toolsCursor, tableCursor. to be honest, I am not sure why we did not call them all simple cursor. there isn't an enum for them too. they are many times defined a a plain text.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to fix the issue now and address improvements afterwards?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, let's merge this. I will create a ticket

[location.query]
);

return (
<SearchQueryBuilderProvider {...eapSpanSearchQueryProviderProps}>
<ModuleFeature moduleName={ModuleName.AGENTS}>
Expand All @@ -162,9 +169,14 @@ function AgentsOverviewPage() {
<ModuleLayout.Full>
<ToolRibbon>
<PageFilterBar condensed>
<InsightsProjectSelector />
<InsightsEnvironmentSelector />
<DatePageFilter {...datePageFilterProps} />
<InsightsProjectSelector resetParamsOnChange={resetParamsOnChange} />
<InsightsEnvironmentSelector
resetParamsOnChange={resetParamsOnChange}
/>
<DatePageFilter
{...datePageFilterProps}
resetParamsOnChange={resetParamsOnChange}
/>
</PageFilterBar>
{!showOnboarding && (
<QueryBuilderWrapper>
Expand Down
Loading