Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Wrap cache query ni a try/catch
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed Sep 20, 2023
commit 10121175b8d32382648c4b4278ba95a39ceb9658
4 changes: 2 additions & 2 deletions js/photos-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-public.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions src/services/PreviewService.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ const SWCacheName = 'images'
* Check if the preview is already cached by the service worker
*
* @param {string} previewUrl - The URL of the preview to check
* @return {Promise<boolean>}
*/
export const isCachedPreview = async function(previewUrl) {
const cache = await window.caches?.open(SWCacheName)
const response = await cache?.match(previewUrl)
return response !== undefined
try {
const cache = await window.caches?.open(SWCacheName)
const response = await cache?.match(previewUrl)
return response !== undefined
} catch {
return false
}
}