Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { Tooltip } from 'react-tooltip';
import styled from '@emotion/styled';
import { format } from 'date-fns';

import { PullRequestIcon } from '@/app/_components/ui/icons/SvgIcons';
import { Theme } from '@/app/_components/ui/theme/theme';
import { formatIntoRelativeDate } from '@/shared-utils/formatIntoRelativeDate';

// TODO: use twenty-ui Tooltip
const StyledTooltip = styled(Tooltip)``;
import { AppTooltip } from 'twenty-ui/display';

const Item = styled.div`
display: flex;
Expand Down Expand Up @@ -97,7 +94,7 @@ export const PullRequestItem = ({
<span id={`date-${prNumber}`}>
{formatIntoRelativeDate(mergedAt ? mergedAt : createdAt)}
</span>
<StyledTooltip
<AppTooltip
anchorSelect={`#date-${prNumber}`}
Comment on lines 94 to 98
Copy link
Contributor

Choose a reason for hiding this comment

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

Tooltip anchor id collision

id={date-${prNumber}} is only derived from the PR number, so if this component is ever rendered with duplicate prNumber values on the same page, the HTML id will be duplicated and anchorSelect={#date-${prNumber}} will bind to the first matching element (wrong tooltip target). Consider including a guaranteed-unique value (e.g. id prop) in both the id and anchorSelect.

content={format(
new Date(mergedAt ? mergedAt : createdAt),
Expand Down