Added the Refresh All button to invalidate caches and force requests to be sent again
This commit is contained in:
@@ -39,7 +39,10 @@ function createConsumptionPlanDetailController({ messageTypes, requestConsumerTo
|
||||
current.promise = (async () => {
|
||||
try {
|
||||
if (!subPlanNum) throw new Error("Sub plan number is unavailable.");
|
||||
if (!pending.has(subPlanNum)) pending.set(subPlanNum, request(subPlanNum).finally(() => pending.delete(subPlanNum)));
|
||||
if (!pending.has(subPlanNum)) {
|
||||
const promise = request(subPlanNum).finally(() => { if (pending.get(subPlanNum) === promise) pending.delete(subPlanNum); });
|
||||
pending.set(subPlanNum, promise);
|
||||
}
|
||||
const items = await pending.get(subPlanNum);
|
||||
if (!section.isConnected || states.get(section) !== current) return;
|
||||
current.status = "ready";
|
||||
@@ -59,5 +62,5 @@ function createConsumptionPlanDetailController({ messageTypes, requestConsumerTo
|
||||
})();
|
||||
return current.promise;
|
||||
}
|
||||
return { createPlanDetailSection, loadPlanDetailForPanel };
|
||||
return { createPlanDetailSection, loadPlanDetailForPanel, resetRequests: () => pending.clear() };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user