Skip to content

Commit

Permalink
Update timeCache of cached users without photo following recheck for …
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
3 people authored Jul 19, 2021
1 parent 174f472 commit 5e1e8e2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/mgt-components/src/graph/graph.userWithPhoto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ export async function getUserWithPhoto(
} else {
cachedPhoto = null;
}
} catch (e) {}
} catch (e) {
//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
if (e.code === 'ErrorItemNotFound') {
storePhotoInCache(userId || 'me', schemas.photos.stores.users, { eTag: null, photo: null });
}
}
}
}

Expand Down

0 comments on commit 5e1e8e2

Please sign in to comment.