Skip to content

Commit 5e1e8e2

Browse files
NathZ1nmetulevbeth-panx
authored
Update timeCache of cached users without photo following recheck for photo via graph (#1247)
* Update timeCache of cached users without photo following recheck for photo via graph * Update packages/mgt-components/src/graph/graph.userWithPhoto.ts Co-authored-by: Nikola Metulev <[email protected]> Co-authored-by: Beth Pan <[email protected]>
1 parent 174f472 commit 5e1e8e2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/mgt-components/src/graph/graph.userWithPhoto.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ export async function getUserWithPhoto(
7373
} else {
7474
cachedPhoto = null;
7575
}
76-
} catch (e) {}
76+
} catch (e) {
77+
//if 404 received (photo not found) but user already in cache, update timeCache value to prevent repeated 404 error / graph calls on each page refresh
78+
if (e.code === 'ErrorItemNotFound') {
79+
storePhotoInCache(userId || 'me', schemas.photos.stores.users, { eTag: null, photo: null });
80+
}
81+
}
7782
}
7883
}
7984

0 commit comments

Comments
 (0)