fix(coding-conventions): Make activity section icon component static#120044
Closed
sentry[bot] wants to merge 1 commit into
Closed
fix(coding-conventions): Make activity section icon component static#120044sentry[bot] wants to merge 1 commit into
sentry[bot] wants to merge 1 commit into
Conversation
| } | ||
| return user ? () => <StyledUserAvatar user={user} /> : IconChat; | ||
| }, | ||
| propsFunction: (_, user, sentry_app) => ({user, sentry_app}), |
Contributor
Author
There was a problem hiding this comment.
Bug: The call to propsFunction in progressActivityTooltip.tsx was not updated after a refactor, causing it to be called with incomplete arguments for GroupActivityType.NOTE.
Severity: MEDIUM
Suggested Fix
Update the call to propsFunction in progressActivityTooltip.tsx at line 100 to pass all required arguments. Change iconMapping.propsFunction?.(item.data) to iconMapping.propsFunction?.(item.data, item.user, item.sentry_app) to match the updated signature.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: static/app/views/issueDetails/activitySection/groupActivityIcons.tsx#L82
Potential issue: A refactor updated the signature of `propsFunction` for
`GroupActivityType.NOTE` to accept `data`, `user`, and `sentry_app` as arguments. While
the call site in `index.tsx` was correctly updated to pass all three, the call site in
`progressActivityTooltip.tsx` was missed and still only passes `item.data`.
Consequently, when a note activity created by a user or Sentry app is displayed in the
progress tooltip, the `user` and `sentry_app` arguments will be `undefined`. This causes
the `NoteActivityIcon` to fall back to rendering a generic chat icon instead of the
correct user or Sentry app avatar, resulting in a functional regression.
Also affects:
static/app/views/issueList/progressActivityTooltip.tsx:100
Did we get this right? 👍 / 👎 to inform future reviews.
Contributor
📊 Type Coverage Diff
🔍 1 new type safety issue introduced
This is informational only and does not block the PR. |
Member
|
replaced by #120047 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses a
static-component-definitionsviolation in the activity section of issue details.Root Cause:
The
componentFunctionforGroupActivityType.NOTEingroupActivityIcons.tsxwas returning new anonymous React components (e.g.,() => <SentryAppAvatar />or() => <StyledUserAvatar />) on every render. This meant that theIconcomponent rendered atstatic/app/views/issueDetails/activitySection/index.tsx:165had a new identity each time, violating the React Compiler'sStaticComponentsdiagnostic.Solution:
NoteActivityIconwas created ingroupActivityIcons.tsx.groupActivityTypeIconMappingforGroupActivityType.NOTEwas updated to useNoteActivityIcondirectly as itsComponent.userandsentry_appdata, previously captured by closures, are now passed as props toNoteActivityIconvia an extendedpropsFunctionsignature.index.tsxwas updated to pass these additional props topropsFunction.This ensures that the icon component has a stable identity across renders, resolving the coding convention violation and allowing for better React Compiler optimization.
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-350
Comment
@sentry <feedback>on this PR to have Autofix iterate on the changes.