From 22dbe1205e423dd2bf416b3986bf55dc94c0c130 Mon Sep 17 00:00:00 2001 From: HighImKevin Date: Thu, 6 Nov 2025 05:37:02 -0500 Subject: [PATCH] Add logging to debug data fetching issues --- utils.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils.js b/utils.js index 05c3626..f24256a 100644 --- a/utils.js +++ b/utils.js @@ -154,6 +154,7 @@ // If a fetch is already in progress for this item, wait for it if (fetchInProgress && fetchItemId === itemId) { + LOG('Fetch already in progress for this item, waiting for it to complete'); return await fetchInProgress; } @@ -161,6 +162,7 @@ fetchItemId = itemId; fetchInProgress = (async () => { try { + LOG('Fetching item:', itemId); const item = await fetchItemById(itemId); cachedItem = item; cachedItemId = itemId; @@ -174,6 +176,7 @@ } })(); + LOG('Fetch in progress for item:', itemId); return await fetchInProgress; } @@ -186,6 +189,7 @@ // Clear cache when view changes to ensure fresh data const currentItemId = getItemIdFromUrl(); if (cachedItemId !== currentItemId) { + LOG('Clearing cache for new item:', currentItemId); cachedItem = null; cachedItemId = null; fetchInProgress = null; // Clear any in-progress fetch for previous item @@ -194,6 +198,7 @@ // Get the item promise once - will be shared across all handlers // The promise is cached/fetched by getCurrentItem(), ensuring only one API call + LOG('Getting current item for ID:', currentItemId); const itemPromise = getCurrentItem(); handlers.forEach((config) => {