From 79c4f38aba51a0d30ad41be8249ab17a8bccffec Mon Sep 17 00:00:00 2001 From: Tyrone Tse Date: Thu, 29 Aug 2024 09:41:53 -0500 Subject: [PATCH] Update cache key generation to conditionally include campaignName - Modified the cache key generation logic to only include campaignName if it is not null or an empty string. --- blocks/gmo-program-details/gmo-program-details.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blocks/gmo-program-details/gmo-program-details.js b/blocks/gmo-program-details/gmo-program-details.js index ec78bef..232e12a 100644 --- a/blocks/gmo-program-details/gmo-program-details.js +++ b/blocks/gmo-program-details/gmo-program-details.js @@ -1025,8 +1025,8 @@ async function getTaskStatusMapping(taskStatus) { } async function addThumbnailToItem(itemEl, programName, campaignName, deliverableType) { - // Create a unique key for the cache based on the parameters - const cacheKey = `${programName}-${campaignName}-${deliverableType}`; + // Create a unique key for the cache based on the parameters, only add the campaignName in cacheKey when it is not null or empty + const cacheKey = campaignName ? `${programName}-${campaignName}-${deliverableType}` : `${programName}-${deliverableType}`; // Check if the imageObject is already cached let imageObject = thumbnailCache[cacheKey];