Archived
fix: cleanup
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
*/
|
||||
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { booksApi } from "../api/books";
|
||||
import { getReadingProgress, updateReadingProgress } from "../api/reader";
|
||||
import { loadEbookWithProgress } from "../api/loadEbookWithProgress";
|
||||
import { updateReadingProgress } from "../api/reader";
|
||||
import type { ReadingProgress } from "../types/reader";
|
||||
import { parsePdfAnchor } from "../utils/pdfAnchor";
|
||||
import { pdfjs, type PdfDocumentProxy } from "../utils/pdfjsSetup";
|
||||
@@ -175,10 +175,7 @@ export function usePdfReader(
|
||||
setIsLoading(true);
|
||||
setError(null);
|
||||
try {
|
||||
const [progressData, blob] = await Promise.all([
|
||||
getReadingProgress(bookId).catch(() => null),
|
||||
booksApi.getEbookFile(bookId),
|
||||
]);
|
||||
const { progressData, blob } = await loadEbookWithProgress(bookId);
|
||||
if (cancelled) return;
|
||||
|
||||
const loadingTask = pdfjs.getDocument({ data: await blob.arrayBuffer() });
|
||||
|
||||
Reference in New Issue
Block a user