Skip to content

fix(discover): Guard undefined fields in EventView.getFields() - #128306

Open
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/discover-guard-undefined-fields-in-get-fields
Open

sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/discover-guard-undefined-fields-in-get-fields

Conversation

@sentry

@sentry sentry Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Problem

When navigating to /explore/errors/ with no field parameters in the URL, EventView.fromSavedQueryOrLocation() falls through to EventView.getFields(saved). If the discover/homepage/ API returns a SavedQuery where fields is undefined at runtime, saved.fields.map() throws TypeError: Cannot read properties of undefined (reading 'map').

Fix

Use nullish coalescing (saved.fields ?? []).map(...) in EventView.getFields() so that undefined fields safely evaluate to an empty list of fields instead of crashing the page.

Verification

  • Added a regression test in static/app/utils/discover/eventView.spec.tsx verifying that a SavedQuery without fields resolves to an EventView with an empty fields array without throwing.
  • Ran oxlint (0 errors, 0 warnings).
  • Ran pnpm test-precommit static/app/utils/discover/eventView.spec.tsx (140/140 passed).

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-3FWT

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

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 October 20, 2026 23:07
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Oct 20, 2026
@getsantry getsantry Bot added the Stale label Nov 11, 2026
@getsantry

getsantry Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

This branch was successfully deployed

1 active deployment
Preview — cef05aec Deployed Oct 20, 2026 by vercel[bot]
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 Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants