Skip to content

Commit

Permalink
fix: 🐛 修复出错图片标识的显示错误
Browse files Browse the repository at this point in the history
  • Loading branch information
hymbz committed Oct 12, 2024
1 parent 496043e commit e26e633
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/Manga/actions/imageLoad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const handleImgError = (url: string, e?: HTMLImageElement) => {
img.type = undefined;
if (
imgIndex.some((i) => renderImgList().has(i)) &&
(imgErrorNum.get(img.src) ?? 0) < 3
(imgErrorNum.get(img.src) ?? 0) < 2
)
img.loadType = 'wait';
});
Expand Down Expand Up @@ -235,7 +235,7 @@ createEffectOn(loadingImgList, async (downImgList, prevImgList) => {
if (abortMap.has(url) || store.imgMap[url].blobUrl) continue;

const controller = new AbortController();
const handleTimeout = debounce(timeoutAbort, 1000 * 5);
const handleTimeout = debounce(timeoutAbort, 1000 * 3);
controller.signal.addEventListener('abort', handleTimeout.clear);
abortMap.set(url, controller);
handleTimeout(url);
Expand Down
3 changes: 3 additions & 0 deletions src/components/Manga/components/ComicImg.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
margin-right: inherit;
margin-bottom: auto;
margin-left: inherit;
}

& > picture,
& > picture::after {
background-color: var(--hover-bg-color, #fff3);
background-image: var(--md-photo);
background-repeat: no-repeat;
Expand Down
1 change: 1 addition & 0 deletions src/helper/other.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ export const waitImgLoad = (
) =>
new Promise<HTMLImageElement>((resolve, reject) => {
const img = typeof target === 'string' ? new Image() : target;
if (img.complete) resolve(img);

const id = timeout
? window.setTimeout(() => reject(new Error('timeout')), timeout)
Expand Down

0 comments on commit e26e633

Please sign in to comment.