Skip to content

fix(performance): Resolve static-component-definitions in performanceWidget#120030

Open
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/performance-static-component-definitions
Open

fix(performance): Resolve static-component-definitions in performanceWidget#120030
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/performance-static-component-definitions

Conversation

@sentry

@sentry sentry Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

This PR addresses the static-component-definitions violation flagged by the React Compiler in static/app/views/performance/landing/widgets/components/performanceWidget.tsx at line 127.

Problem:
The Container component, used within the DataDisplay functional component, was being determined by calling getPerformanceWidgetContainer({containerType}) during render. Although getPerformanceWidgetContainer returns one of two pre-defined static styled components (StyledPanel or Div), the act of calling a function to determine the component type within the render body makes it appear as a dynamically created component to the React Compiler. This violates the StaticComponents rule, which can lead to unnecessary component unmounting/remounting, state resets, and blocks compiler optimizations.

Solution:
To resolve this, the getPerformanceWidgetContainer factory function in performanceWidgetContainer.tsx has been replaced with a module-scoped static map named PERFORMANCE_WIDGET_CONTAINERS. This map directly associates each PerformanceWidgetContainerTypes value with its corresponding static styled component.

In performanceWidget.tsx, the DataDisplay component now directly accesses PERFORMANCE_WIDGET_CONTAINERS[containerType] to retrieve the Container component. This ensures that the Container reference is always a stable, statically defined component, satisfying the React Compiler's StaticComponents diagnostic without altering the intended runtime behavior.

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 CODING-CONVENTIONS-35A

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

@sentry
sentry Bot requested a review from a team as a code owner July 19, 2026 19:55
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 19, 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.

1 participant