fix: cleanup

This commit is contained in:
2026-06-04 06:42:27 -05:00
parent f989b144cf
commit 654cfec147
52 changed files with 290 additions and 540 deletions
+3 -6
View File
@@ -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() });