From e3fc8f41955e5b08eb023e9c390fada550887f2a Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Wed, 19 Feb 2025 17:28:22 +0100 Subject: [PATCH] Fix typing after "apollo-client" update to v3.13.1 Introduced due to the apollo-client dependency update in f39c902b5fe0fa0cc7cf1260f81fba065a6cac04 --- src/modules/chapter/services/Chapters.ts | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/modules/chapter/services/Chapters.ts b/src/modules/chapter/services/Chapters.ts index 09b27bd7..d62f54ba 100644 --- a/src/modules/chapter/services/Chapters.ts +++ b/src/modules/chapter/services/Chapters.ts @@ -7,7 +7,6 @@ */ import { t as translate } from 'i18next'; -import gql from 'graphql-tag'; import { DocumentNode, MaybeMasked, Unmasked, useFragment } from '@apollo/client'; import { makeToast } from '@/modules/core/utils/Toast.ts'; import { requestManager } from '@/lib/requests/RequestManager.ts'; @@ -168,23 +167,10 @@ export class Chapters { } static isDownloading(id: number): boolean { - return !!requestManager.graphQLClient.client.cache.readFragment({ - id: requestManager.graphQLClient.client.cache.identify({ - __typename: 'DownloadType', - chapter: { - __ref: requestManager.graphQLClient.client.cache.identify({ - __typename: 'ChapterType', - id, - }), - }, - }), - fragment: gql` - fragment CHAPTER_DOWNLOAD_QUEUE_CHECK on ChapterType { - id - } - `, - fragmentName: 'CHAPTER_DOWNLOAD_QUEUE_CHECK', - }); + const activeDownloadStates = [DownloadState.Downloading, DownloadState.Queued]; + const downloadStatus = Chapters.getDownloadStatusFromCache(id); + + return activeDownloadStates.includes(downloadStatus?.state as DownloadState); } static isDownloaded({ isDownloaded }: ChapterDownloadInfo): boolean {