Skip to content

Commit 9ce10ba

Browse files
authored
fix(related_issues): Prevent race condition (#72036)
When fetching events, `oneOtherIssueEvent` is `undefined`, thus, we need to wait until we're certain that the fetch has been completed to prevent rendering twice or the wrong state. I introduced this problem in #71999.
1 parent 28e500e commit 9ce10ba

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

static/app/views/issueDetails/groupEventHeader.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@ function GroupEventHeader({event, group, project}: GroupEventHeaderProps) {
2626
'related-issues-issue-details-page'
2727
);
2828
// This is also called within the TraceTimeline component but caching will save a second call
29-
const {oneOtherIssueEvent} = useTraceTimelineEvents({
29+
const {isLoading, oneOtherIssueEvent} = useTraceTimelineEvents({
3030
event,
3131
});
3232

3333
return (
3434
<StyledDataSection>
3535
<GroupEventCarousel group={group} event={event} projectSlug={project.slug} />
36-
{isRelatedIssuesEnabled && oneOtherIssueEvent && (
36+
{isRelatedIssuesEnabled && !isLoading && oneOtherIssueEvent && (
3737
<StyledTraceLink>
3838
One other issue appears in the same trace.
3939
<TraceLink event={event} />
4040
</StyledTraceLink>
4141
)}
4242
{/* This will be the default when we have GAed related issues */}
43-
{isRelatedIssuesEnabled && oneOtherIssueEvent === undefined && (
43+
{isRelatedIssuesEnabled && !isLoading && oneOtherIssueEvent === undefined && (
4444
<TraceLink event={event} />
4545
)}
4646
{issueTypeConfig.traceTimeline && <TraceTimeline event={event} />}

0 commit comments

Comments
 (0)