Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export function getLinkedPullRequestActivityIds(group: Group) {

interface LinkedPullRequestsProps {
group: Group;
showChecksAndReview?: boolean;
showEmptyState?: boolean;
}

Expand Down Expand Up @@ -231,23 +232,36 @@ function SeerAttributionAvatar() {
);
}

export function useLinkedPullRequests({group}: {group: Group}) {
export function useLinkedPullRequests({
group,
includeChecksAndReview = true,
}: {
group: Group;
includeChecksAndReview?: boolean;
}) {
const organization = useOrganization();

return useQuery(
apiOptions.as<LinkedPullRequestsResponse>()(
'/organizations/$organizationIdOrSlug/issues/$issueId/pull-requests/',
{
path: {organizationIdOrSlug: organization.slug, issueId: group.id},
query: {expand: 'checksAndReview'},
query: includeChecksAndReview ? {expand: 'checksAndReview'} : undefined,
staleTime: 30_000,
}
)
);
}

export function LinkedPullRequests({group, showEmptyState}: LinkedPullRequestsProps) {
const {data, isError, isPending} = useLinkedPullRequests({group});
export function LinkedPullRequests({
group,
showChecksAndReview = true,
showEmptyState,
}: LinkedPullRequestsProps) {
const {data, isError, isPending} = useLinkedPullRequests({
group,
includeChecksAndReview: showChecksAndReview,
});
const activityPullRequestIds = getLinkedPullRequestActivityIds(group);

if (isError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface Props {
export function ExternalIssueSidebarList({event, group}: Props) {
const externalIssueData = useGroupExternalIssues({group, event});
const {data: linkedPullRequestsData, isPending: isLinkedPullRequestsLoading} =
useLinkedPullRequests({group});
useLinkedPullRequests({group, includeChecksAndReview: false});
const hasLinkedPullRequestActivity = getLinkedPullRequestActivityIds(group).size > 0;
const showEmptyIssueTrackerAction =
!externalIssueData.isLoading &&
Expand Down Expand Up @@ -60,6 +60,7 @@ export function ExternalIssueSidebarList({event, group}: Props) {
<ErrorBoundary customComponent={null}>
<LinkedPullRequests
group={group}
showChecksAndReview={false}
showEmptyState={
!showEmptyIssueTrackerAction &&
!externalIssueData.isLoading &&
Expand Down
Loading