ref(dashboards): Clean up RevisionListItem logic and naming#114161
Merged
ref(dashboards): Clean up RevisionListItem logic and naming#114161
Conversation
…up in WidgetDiffCard Collapse two separate if/else chains for statusLabel and tagVariant into a single STATUS_MAP record. The map is exhaustive by type, so adding a new status value will surface a TypeScript error. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…hain Replace a 4-level ternary in RevisionListItem with a dedicated RevisionDiffBody component that uses early returns. Also pre-computes isError from the two separate error conditions so the inline compound expression is gone. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Export RevisionDiffBody so it can be rendered directly in stories. Add loading and error state stories that were previously impossible to show without mocking hooks. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rename to follow ALL_CAPS convention for module-level constants and make the connection to the DisplayType enum explicit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
DominikB2014
approved these changes
Apr 28, 2026
Contributor
DominikB2014
left a comment
There was a problem hiding this comment.
🧹 nice cleanup, easier to read/follow imo
DominikB2014
approved these changes
Apr 28, 2026
Comment on lines
+262
to
+264
| added: {label: t('Added'), variant: 'success'}, | ||
| removed: {label: t('Removed'), variant: 'danger'}, | ||
| modified: {label: t('Modified'), variant: 'warning'}, |
Contributor
There was a problem hiding this comment.
There should be a type we can reuse for variant?
Contributor
Author
There was a problem hiding this comment.
Found it - thanks!
| isError: boolean; | ||
| snapshot: DashboardDetails | undefined; | ||
| }) { | ||
| if (isAnyLoading) return <LoadingIndicator />; |
Contributor
There was a problem hiding this comment.
should we just do isLoading as the prop? When your in the context of this component, i don't think the keyword Any is relevant right?
Contributor
Author
There was a problem hiding this comment.
Yep, that's better 👍
Rename isAnyLoading prop to isLoading on RevisionDiffBody — the Any qualifier is not meaningful from the component's perspective. Use TagVariant from sentry/utils/theme instead of an inline union for the STATUS_MAP variant field. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cleptric
pushed a commit
that referenced
this pull request
May 5, 2026
Small readability refactors to `RevisionListItem` and `typeSelector` — no behavior changes. * Add mappers and a new component function for rendering different widget diff statuses * rename of the widget display map constant --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Small readability refactors to
RevisionListItemandtypeSelector— no behavior changes.