diff --git a/src/home/fetch-github/fetch-and-display-previews.ts b/src/home/fetch-github/fetch-and-display-previews.ts index 75dceb14..585643ba 100644 --- a/src/home/fetch-github/fetch-and-display-previews.ts +++ b/src/home/fetch-github/fetch-and-display-previews.ts @@ -48,7 +48,7 @@ function displayIssues(issues: GitHubIssue[], container: HTMLDivElement, sorting if (orgName) { const avatarUrl = await getImageFromDB({ dbName: "ImageDatabase", storeName: "ImageStore", orgName: `avatarUrl-${orgName}` }); if (avatarUrl) { - organizationImageCache.push({ [orgName]: avatarUrl }); + organizationImageCache.set(orgName, avatarUrl); } } }); diff --git a/src/home/rendering/render-github-issues.ts b/src/home/rendering/render-github-issues.ts index 92ffd82f..6cb94200 100644 --- a/src/home/rendering/render-github-issues.ts +++ b/src/home/rendering/render-github-issues.ts @@ -69,19 +69,15 @@ function setUpIssueElement( ) { let image = ``; - const orgCacheEntry = organizationImageCache.find((entry) => Object.prototype.hasOwnProperty.call(entry, organizationName)); - const avatarUrl = orgCacheEntry ? orgCacheEntry[organizationName] : null; + const avatarUrl = organizationImageCache.get(organizationName); if (avatarUrl) { image = ``; } - const avatarBlob = organizationImageCache.find((entry) => entry[organizationName]); + const avatarBlob = organizationImageCache.get(organizationName); if (avatarBlob) { - const blob = avatarBlob[organizationName]; - if (blob) { - const avatarUrl = URL.createObjectURL(blob); - image = ``; - } + const avatarUrl = URL.createObjectURL(avatarBlob); + image = ``; } issueElement.innerHTML = `