From b1c8ecfba95e4029eea932fc47329bc36ffdb6d8 Mon Sep 17 00:00:00 2001 From: tyler Date: Sat, 30 Sep 2023 02:07:05 +0000 Subject: [PATCH] Gracefully disable useRequest() cache when no request is active --- packages/server/src/arpa_reporter/services/records.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/server/src/arpa_reporter/services/records.js b/packages/server/src/arpa_reporter/services/records.js index 529a65941..a7d13ca1e 100644 --- a/packages/server/src/arpa_reporter/services/records.js +++ b/packages/server/src/arpa_reporter/services/records.js @@ -171,6 +171,11 @@ async function loadRecordsForUpload(upload) { async function recordsForUpload(upload, req = useRequest()) { log(`recordsForUpload(${upload.id})`); + if (req === undefined) { + // Will not cache outside of a request + req = {}; + } + if (!req.recordsForUpload) { req.recordsForUpload = {}; }