Skip to content

fix(discover): Handle undefined saved query dataset - #122106

Open
sentry[bot] wants to merge 2 commits into
masterfrom
seer/fix/discover-undefined-dataset
Open

fix(discover): Handle undefined saved query dataset#122106
sentry[bot] wants to merge 2 commits into
masterfrom
seer/fix/discover-undefined-dataset

Conversation

@sentry

@sentry sentry Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Addresses JAVASCRIPT-38Z5, a TypeError: can't access property "environment", e is undefined occurring on /explore/discover/homepage/.

The root cause was identified in static/app/views/discover/results.tsx within the checkEventView method. When getSavedQueryDataset returns a value that is not a key in DEFAULT_EVENT_VIEW_MAP (e.g., an unrecognized or missing dataset), the lookup DEFAULT_EVENT_VIEW_MAP[value] evaluates to undefined. This undefined value was then passed as the newQuery argument to EventView.fromNewQueryWithLocation.

Inside EventView.fromNewQueryWithLocation, an attempt to access newQuery.environment (line 415 in static/app/utils/discover/eventView.tsx) on an undefined newQuery object resulted in the reported TypeError.

This fix introduces a nullish coalescing operator (?? DEFAULT_EVENT_VIEW) at the point of the DEFAULT_EVENT_VIEW_MAP lookup in checkEventView. This ensures that if DEFAULT_EVENT_VIEW_MAP[value] is undefined, DEFAULT_EVENT_VIEW is used as a fallback, preventing undefined from being passed to EventView.fromNewQueryWithLocation and thus resolving the TypeError.

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-38Z5

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@sentry
sentry Bot requested a review from a team as a code owner August 14, 2026 22:43
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Aug 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

Metric Before After Delta
Coverage 94.36% 94.36% ±0%
Typed 134,654 134,654 ±0
Untyped 8,048 8,048 ±0
🔍 1 new type safety issue introduced

Type assertions (as) (1 new)

File Line Detail
static/app/views/discover/results.tsx 444 as NewQuerygetSavedQueryWithDataset( DEFAULT_EVENT_VIEW_MAP[value] ?? DEFAULT_EVENT_VIEW )…

This is informational only and does not block the PR.

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