File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { organizationImageCache } from "./fetch-issues-full";
5
5
6
6
export async function fetchAvatar ( orgName : string ) {
7
7
// Check local cache first
8
- const cachedAvatar = organizationImageCache . find ( ( entry ) => entry [ orgName ] !== undefined ) ;
8
+ const cachedAvatar = organizationImageCache . get ( orgName ) ;
9
9
if ( cachedAvatar ) {
10
10
return Promise . resolve ( ) ;
11
11
}
@@ -14,7 +14,7 @@ export async function fetchAvatar(orgName: string) {
14
14
const avatarBlob = await getImageFromDB ( { dbName : "ImageDatabase" , storeName : "ImageStore" , orgName : `avatarUrl-${ orgName } ` } ) ;
15
15
if ( avatarBlob ) {
16
16
// If the avatar Blob is found in IndexedDB, add it to the cache
17
- organizationImageCache . push ( { [ orgName ] : avatarBlob } ) ;
17
+ organizationImageCache . set ( orgName , avatarBlob ) ;
18
18
return Promise . resolve ( ) ;
19
19
}
20
20
@@ -35,11 +35,11 @@ export async function fetchAvatar(orgName: string) {
35
35
orgName : `avatarUrl-${ orgName } ` ,
36
36
avatarBlob : blob ,
37
37
} ) ;
38
- organizationImageCache . push ( { [ orgName ] : blob } ) ;
38
+ organizationImageCache . set ( orgName , blob ) ;
39
39
} ) ;
40
40
}
41
41
} )
42
42
. catch ( ( error ) => {
43
43
console . error ( `Failed to fetch avatar for organization ${ orgName } : ${ error } ` ) ;
44
44
} ) ;
45
- }
45
+ }
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { PreviewToFullMapping } from "./preview-to-full-mapping";
7
7
8
8
export const previewToFullMapping = new PreviewToFullMapping ( ) . getMapping ( ) ;
9
9
10
- export const organizationImageCache = [ ] as { [ organization : string ] : Blob | null } [ ] ;
10
+ export const organizationImageCache = new Map < string , Blob | null > ( ) ;
11
11
12
12
export function fetchIssuesFull ( previews : GitHubIssue [ ] ) {
13
13
const authToken = getGitHubAccessToken ( ) ;
You can’t perform that action at this time.
0 commit comments