Improved the background request loading order
This commit is contained in:
@@ -9,6 +9,7 @@ function createFusionOpportunities({
|
||||
getOpportunityTypeValues,
|
||||
readResponseBodyForDebug,
|
||||
resetDebugRequests = () => {},
|
||||
loadServiceRequests = async () => {},
|
||||
environment
|
||||
}) {
|
||||
const { fetch } = environment;
|
||||
@@ -37,7 +38,13 @@ function createFusionOpportunities({
|
||||
const payload = createOpportunitiesQueryPayload(dateRange, offset, savedSearchNumber);
|
||||
const requestBody = JSON.stringify(payload);
|
||||
// One history per query, preserving all pages of the same result set.
|
||||
if (page === 1) resetDebugRequests();
|
||||
if (page === 1) {
|
||||
resetDebugRequests();
|
||||
// SR queries do not depend on opportunity or product IDs. Keep their
|
||||
// diagnostics in this query's history and reuse the loaded SR state later.
|
||||
try { await loadServiceRequests(token, requestVersion); } catch { /* SR failure must not block opportunities. */ }
|
||||
if (!isCurrentPeriodRequest(requestVersion)) return null;
|
||||
}
|
||||
const requestEntry = logRequestStart({
|
||||
name: "requestOpportunities",
|
||||
method: "POST",
|
||||
|
||||
Reference in New Issue
Block a user