Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 34161ae

Browse files
getneilneil molina
andauthored
load image faster: do not preload if url is local (#563)
Co-authored-by: neil molina <neil@neils-MacBook-Pro.local>
1 parent ae02ff0 commit 34161ae

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

modules/desktop/src/components/package-card/bg-image.svelte

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,20 @@
1616
let lastProcessedPkg: GUIPackage | null = null;
1717
1818
const loadImage = async (url: string): Promise<string> => {
19+
if (url.includes("cached_images")) {
20+
loadedImg = url;
21+
loaded = true;
22+
return url;
23+
}
24+
1925
const image = new Image();
2026
image.src = url;
2127
return new Promise((resolve, reject) => {
2228
image.onload = () => {
2329
loadedImg = url;
2430
setTimeout(() => {
2531
loaded = true;
26-
}, 300);
32+
}, 100);
2733
resolve(url);
2834
};
2935
image.onerror = () => {

0 commit comments

Comments
 (0)