Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions static/app/components/idBadge/projectBadge.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {cloneElement} from 'react';
import {cloneElement, memo} from 'react';
import styled from '@emotion/styled';

import type {LinkProps} from 'sentry/components/core/link';
Expand Down Expand Up @@ -101,4 +101,4 @@ const StyledLink = styled(Link)`
}
`;

export default ProjectBadge;
export default memo(ProjectBadge);
5 changes: 4 additions & 1 deletion static/app/views/explore/logs/fieldRenderers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
import {DateTime} from 'sentry/components/dateTime';
import Duration from 'sentry/components/duration/duration';
import useStacktraceLink from 'sentry/components/events/interfaces/frame/useStacktraceLink';
import ProjectBadge from 'sentry/components/idBadge/projectBadge';

Check failure on line 10 in static/app/views/explore/logs/fieldRenderers.tsx

View workflow job for this annotation

GitHub Actions / typescript

'ProjectBadge' is declared but its value is never read.
import Version from 'sentry/components/version';
import {IconPlay} from 'sentry/icons';
import {tct} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {Project} from 'sentry/types/project';
import type {AvatarProject, Project} from 'sentry/types/project';

Check failure on line 15 in static/app/views/explore/logs/fieldRenderers.tsx

View workflow job for this annotation

GitHub Actions / typescript

'AvatarProject' is declared but never used.
import {stripAnsi} from 'sentry/utils/ansiEscapeCodes';
import type {EventsMetaType} from 'sentry/utils/discover/eventView';
import {
Expand All @@ -23,6 +24,8 @@
import ViewReplayLink from 'sentry/utils/discover/viewReplayLink';
import {getShortEventId} from 'sentry/utils/events';
import normalizeUrl from 'sentry/utils/url/normalizeUrl';
import useProjectFromId from 'sentry/utils/useProjectFromId';

Check failure on line 27 in static/app/views/explore/logs/fieldRenderers.tsx

View workflow job for this annotation

GitHub Actions / typescript

'useProjectFromId' is declared but its value is never read.
import useProjects from 'sentry/utils/useProjects';

Check failure on line 28 in static/app/views/explore/logs/fieldRenderers.tsx

View workflow job for this annotation

GitHub Actions / typescript

'useProjects' is declared but its value is never read.
import {useRelease} from 'sentry/utils/useRelease';
import {QuickContextHoverWrapper} from 'sentry/views/discover/table/quickContext/quickContextWrapper';
import {ContextType} from 'sentry/views/discover/table/quickContext/utils';
Expand Down
2 changes: 2 additions & 0 deletions static/app/views/explore/logs/tables/logsInfiniteTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import useJumpButtons from 'sentry/components/replays/useJumpButtons';
import {GridResizer} from 'sentry/components/tables/gridEditable/styles';
import {IconArrow, IconWarning} from 'sentry/icons';
import {t, tct} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {TagCollection} from 'sentry/types/group';
import {defined} from 'sentry/utils';
import {
Expand Down Expand Up @@ -331,6 +332,7 @@ export function LogsInfiniteTable({
'.log-table-row-chevron-button': {
width: theme.isChonk ? '24px' : '18px',
height: theme.isChonk ? '24px' : '18px',
padding: `${space(0.5)} ${space(0.75)}`,
marginRight: '4px',
display: 'flex',
alignItems: 'center',
Expand Down
11 changes: 8 additions & 3 deletions static/app/views/explore/logs/tables/logsTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import omit from 'lodash/omit';

import {Button} from 'sentry/components/core/button';
import {EmptyStreamWrapper} from 'sentry/components/emptyStateWarning';
import ProjectBadge from 'sentry/components/idBadge/projectBadge';
import LoadingIndicator from 'sentry/components/loadingIndicator';
import {IconAdd, IconJson, IconSubtract, IconWarning} from 'sentry/icons';
import {IconChevron} from 'sentry/icons/iconChevron';
Expand All @@ -22,6 +23,7 @@ import useCopyToClipboard from 'sentry/utils/useCopyToClipboard';
import {useLocation} from 'sentry/utils/useLocation';
import useOrganization from 'sentry/utils/useOrganization';
import useProjectFromId from 'sentry/utils/useProjectFromId';
import useProjects from 'sentry/utils/useProjects';
import CellAction, {
Actions,
ActionTriggerType,
Expand All @@ -36,6 +38,7 @@ import {
import type {TraceItemDetailsResponse} from 'sentry/views/explore/hooks/useTraceItemDetails';
import {useFetchTraceItemDetailsOnHover} from 'sentry/views/explore/hooks/useTraceItemDetails';
import {
AlwaysPresentLogFields,
DEFAULT_TRACE_ITEM_HOVER_TIMEOUT,
DEFAULT_TRACE_ITEM_HOVER_TIMEOUT_WITH_AUTO_REFRESH,
HiddenLogDetailFields,
Expand Down Expand Up @@ -149,6 +152,7 @@ export const LogRowContent = memo(function LogRowContent({
const location = useLocation();
const organization = useOrganization();
const fields = useQueryParamsFields();
const projects = useProjects();

const autorefreshEnabled = useLogsAutoRefreshEnabled();
const setAutorefresh = useSetLogsAutoRefresh();
Expand Down Expand Up @@ -227,9 +231,9 @@ export const LogRowContent = memo(function LogRowContent({

const severityNumber = dataRow[OurLogKnownFieldKey.SEVERITY_NUMBER];
const severityText = dataRow[OurLogKnownFieldKey.SEVERITY];
const project = useProjectFromId({
project_id: '' + dataRow[OurLogKnownFieldKey.PROJECT_ID],
});
const projectId: (typeof AlwaysPresentLogFields)[1] =
dataRow[OurLogKnownFieldKey.PROJECT_ID];
const project = projects.projects.find(p => p.id === '' + projectId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Project Badge Rendering Issue

Replacing useProjectFromId with a lookup in useProjects().projects could prevent project badges from rendering. This happens if useProjects() doesn't include all visible projects, or due to a type mismatch when comparing p.id with projectId.

Fix in Cursor Fix in Web

const projectSlug = project?.slug ?? '';

const level = getLogSeverityLevel(
Expand Down Expand Up @@ -335,6 +339,7 @@ export const LogRowContent = memo(function LogRowContent({
<span className="log-table-row-chevron-button">{chevronIcon}</span>
)}
<SeverityCircleRenderer extra={rendererExtra} meta={meta} />
{project ? <ProjectBadge project={project} avatarSize={12} hideName /> : null}
</LogFirstCellContent>
</LogsTableBodyFirstCell>
{fields?.map(field => {
Expand Down
Loading