Skip to content

fix(pageFilters): Handle invalid stats period gracefully - #121496

Open
sentry[bot] wants to merge 3 commits into
masterfrom
seer/fix/invalid-stats-period-P05wPR
Open

fix(pageFilters): Handle invalid stats period gracefully#121496
sentry[bot] wants to merge 3 commits into
masterfrom
seer/fix/invalid-stats-period-P05wPR

Conversation

@sentry

@sentry sentry Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor
This PR addresses JAVASCRIPT-3925, an issue where the application would crash with an "Error: Invalid stats period" when an unvalidated period string was passed to `parseStatsPeriod`.

The root cause was that pageFilters.datetime.period, which can originate from localStorage or the URL, was not validated against STATS_PERIOD_REGEX before being used by parseStatsPeriod. If the period was malformed or stale, parseStatsPeriod would throw, leading to a page crash.

The solution involves:

  1. Exporting STATS_PERIOD_REGEX from static/app/components/timeRangeSelector/utils.tsx.
  2. In static/app/components/pageFilters/actions.tsx, before calling parseStatsPeriod, pageFilters.datetime.period is now checked against STATS_PERIOD_REGEX. If the period is invalid, it is reset to the defaultDatetime.period (e.g., "14d") instead of allowing parseStatsPeriod to throw. This ensures the page loads with a valid default time range.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes JAVASCRIPT-3925

Comment @sentry <feedback> on this PR to have Autofix iterate on the changes.

@sentry
sentry Bot marked this pull request as ready for review August 6, 2026 22:47
@sentry
sentry Bot requested a review from a team as a code owner August 6, 2026 22:47
@sentry
sentry Bot requested a review from nikkikapadia August 6, 2026 22:47
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Aug 6, 2026
@sentry sentry Bot changed the title fix(page-filters): Handle invalid stats period gracefully fix(pageFilters): Handle invalid stats period gracefully Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants