Rework #6
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -39,10 +39,14 @@ function ComicViewer({
 | 
			
		|||
 | 
			
		||||
    useEffect(() => {
 | 
			
		||||
        if(currentImageRef.current){
 | 
			
		||||
            if (curPage < 0 || curPage >= totalPage) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            const img = new Image();
 | 
			
		||||
            img.src = `/api/doc/${doc.id}/comic/${curPage}`;
 | 
			
		||||
            if (img.complete) {
 | 
			
		||||
                currentImageRef.current.src = img.src;
 | 
			
		||||
                setFade(false);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            setFade(true);
 | 
			
		||||
| 
						 | 
				
			
			@ -60,7 +64,7 @@ function ComicViewer({
 | 
			
		|||
                // TODO: use web worker to abort loading image in the future
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
    }, [curPage, doc.id]);
 | 
			
		||||
    }, [curPage, doc.id, totalPage]);
 | 
			
		||||
 | 
			
		||||
    return (
 | 
			
		||||
        <div className="overflow-hidden w-full h-full relative">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue