Skip to content

Commit

Permalink
fix(issue-stream): Don't wait for stats request before displaying iss…
Browse files Browse the repository at this point in the history
…ues (#84257)
  • Loading branch information
malwilley authored Jan 29, 2025
1 parent 5d06036 commit 8b4d725
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions static/app/views/issueList/overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,14 @@ function IssueListOverview({router}: Props) {
}
GroupStore.add(data);

await fetchStats(data.map((group: BaseGroup) => group.id));
if (data.length === 0) {
trackAnalytics('issue_search.empty', {
organization,
search_type: 'issues',
search_source: 'main_search',
query,
});
}

const hits = resp.getResponseHeader('X-Hits');
const newQueryCount =
Expand All @@ -583,29 +590,22 @@ function IssueListOverview({router}: Props) {
typeof maxHits !== 'undefined' && maxHits ? parseInt(maxHits, 10) || 0 : 0;
const newPageLinks = resp.getResponseHeader('Link');

fetchCounts(newQueryCount, fetchAllCounts);

setError(null);
setIssuesLoading(false);
setQueryCount(newQueryCount);
setQueryMaxCount(newQueryMaxCount);
setPageLinks(newPageLinks !== null ? newPageLinks : '');

fetchCounts(newQueryCount, fetchAllCounts);

// Need to wait for stats request to finish before saving to cache
await fetchStats(data.map((group: BaseGroup) => group.id));
IssueListCacheStore.save(requestParams, {
groups: GroupStore.getState() as Group[],
queryCount: newQueryCount,
queryMaxCount: newQueryMaxCount,
pageLinks: newPageLinks ?? '',
});

if (data.length === 0) {
trackAnalytics('issue_search.empty', {
organization,
search_type: 'issues',
search_source: 'main_search',
query,
});
}
},
error: err => {
trackAnalytics('issue_search.failed', {
Expand Down

0 comments on commit 8b4d725

Please sign in to comment.