Skip to content
Draft
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
18 changes: 15 additions & 3 deletions static/app/utils/useMaxPickableDays.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,30 @@ export function getMaxPickableDays(
): MaxPickableDaysOptions {
switch (dataCategory) {
case DataCategory.SPANS:
case DataCategory.SPANS_INDEXED:
case DataCategory.SPANS_INDEXED: {
const maxPickableDays = organization.features.includes(
'visibility-explore-range-high'
)
? MAX_PICKABLE_DAYS
: 30;

return {
maxPickableDays,
maxUpgradableDays: MAX_PICKABLE_DAYS,
upsellFooter: SpansUpsellFooter,
};
}
case DataCategory.ERRORS: {
const maxPickableDays = organization.features.includes(
'visibility-explore-range-high'
)
? MAX_PICKABLE_DAYS
: 30;

return {
maxPickableDays,
maxUpgradableDays: MAX_PICKABLE_DAYS,
upsellFooter:
dataCategory === DataCategory.ERRORS ? ErrorsUpsellFooter : SpansUpsellFooter,
upsellFooter: ErrorsUpsellFooter,
};
}
case DataCategory.TRACE_METRICS:
Expand Down
11 changes: 3 additions & 8 deletions static/app/views/discover/homepage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import {getApiUrl} from 'sentry/utils/api/getApiUrl';
import {EventView} from 'sentry/utils/discover/eventView';
import {useApiQuery} from 'sentry/utils/queryClient';
import {useApi} from 'sentry/utils/useApi';
import {useDatePageFilterProps} from 'sentry/utils/useDatePageFilterProps';
import {useLocation} from 'sentry/utils/useLocation';
import {useMaxPickableDays} from 'sentry/utils/useMaxPickableDays';
import {useNavigate} from 'sentry/utils/useNavigate';
import {useOrganization} from 'sentry/utils/useOrganization';
import {usePrevious} from 'sentry/utils/usePrevious';
import {useGlobalAlerts} from 'sentry/views/app/globalAlerts';
import {getSavedQueryWithDataset} from 'sentry/views/discover/savedQuery/utils';
import {getDiscoverDeprecation} from 'sentry/views/discover/utils';

import {Results} from './results';

Expand Down Expand Up @@ -143,17 +143,12 @@ function Homepage() {
}

export default function HomepageContainer() {
const organization = useOrganization();
const maxPickableDays = useMaxPickableDays({
dataCategories: [DataCategory.ERRORS],
});
const datePageFilterProps = useDatePageFilterProps(maxPickableDays);
return (
<PageFiltersContainer
skipInitializeUrlParams
maxPickableDays={
getDiscoverDeprecation(organization) ? maxPickableDays.maxPickableDays : undefined
}
>
<PageFiltersContainer skipInitializeUrlParams {...datePageFilterProps}>
<AiQueryProvider>
<Homepage />
</AiQueryProvider>
Expand Down
15 changes: 4 additions & 11 deletions static/app/views/discover/results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import {generateQueryWithTag} from 'sentry/utils/queryString';
import {decodeList, decodeScalar} from 'sentry/utils/queryString';
import {normalizeUrl} from 'sentry/utils/url/normalizeUrl';
import {useApi} from 'sentry/utils/useApi';
import {useDatePageFilterProps} from 'sentry/utils/useDatePageFilterProps';
import {useLocation} from 'sentry/utils/useLocation';
import {useMaxPickableDays} from 'sentry/utils/useMaxPickableDays';
import {useNavigate} from 'sentry/utils/useNavigate';
Expand Down Expand Up @@ -106,7 +107,6 @@ import {
import Table from 'sentry/views/discover/table';
import {
generateTitle,
getDiscoverDeprecation,
getDiscoverDeprecationEnabled,
getTransactionsDeprecation,
handleAddQueryToDashboard,
Expand Down Expand Up @@ -1404,6 +1404,7 @@ function DiscoverPageFilters({
const maxPickableDays = useMaxPickableDays({
dataCategories: [DataCategory.ERRORS],
});
const datePageFilterProps = useDatePageFilterProps(maxPickableDays);

const currentDataset = getDatasetFromLocationOrSavedQueryDataset(
location,
Expand Down Expand Up @@ -1439,13 +1440,7 @@ function DiscoverPageFilters({
<PageFilterBar condensed>
<ProjectPageFilter />
<EnvironmentPageFilter />
<DatePageFilter
maxPickableDays={
getDiscoverDeprecation(organization)
? maxPickableDays.maxPickableDays
: undefined
}
/>
<DatePageFilter {...datePageFilterProps} />
</PageFilterBar>
<Flex gap="md" align="center">
{!shouldHideCreateAlert && (
Expand Down Expand Up @@ -1598,9 +1593,7 @@ export default function ResultsContainer() {
disablePersistence={
organization.features.includes('discover-query') && !!location.query.id
}
maxPickableDays={
getDiscoverDeprecation(organization) ? maxPickableDays.maxPickableDays : undefined
}
maxPickableDays={maxPickableDays.maxPickableDays}
skipLoadLastUsed={false}
// The Discover Results component will manage URL params, including page filters state
// This avoids an unnecessary re-render when forcing a project filter for team plan users
Expand Down
Loading