Move download status subscription to "ChapterCard"

Only re-render chapters whose download status has changed instead of the whole list everytime a download status change was received
This commit is contained in:
schroda
2025-01-12 15:05:09 +01:00
parent f7b26767a3
commit 257c0c8e10
11 changed files with 107 additions and 205 deletions

View File

@@ -30,7 +30,7 @@ import { Chapters } from '@/modules/chapter/services/Chapters.ts';
export const ChapterUpdateCard = ({ chapter }: { chapter: ChapterUpdateListFieldsFragment }) => {
const { manga } = chapter;
const download = Chapters.getDownloadStatusFromCache(chapter.id);
const download = Chapters.useDownloadStatusFromCache(chapter.id);
const { t } = useTranslation();
const location = useLocation();
@@ -112,7 +112,7 @@ export const ChapterUpdateCard = ({ chapter }: { chapter: ChapterUpdateListField
</TypographyMaxLines>
</Box>
</Box>
{download && <DownloadStateIndicator download={download} />}
<DownloadStateIndicator chapterId={chapter.id} />
{download?.state === DownloadState.Error && (
<Tooltip title={t('global.button.retry')}>
<IconButton