Skip to content

Commit

Permalink
Merge pull request #241 from Suwayomi/main
Browse files Browse the repository at this point in the history
fix migrate page
  • Loading branch information
Robonau authored Nov 15, 2024
2 parents c88c199 + 1f28e7d commit 8d7ca49
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions src/routes/(app)/browse/migrate/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import { sourcesMigration } from '$lib/gql/Queries';
import { SourceTypeFragment } from '$lib/gql/Fragments';
import { queryState } from '$lib/util.svelte';
import { untrack } from 'svelte';
AppBarData('Migrate');
const client = getContextClient();
Expand All @@ -37,25 +38,28 @@
data: ResultOf<typeof sourcesMigration> | undefined
) {
if (!data?.sources || !data.mangas) return undefined;
const tmpSources: sourceWithMangaCount[] = data.sources.nodes;
data.mangas.nodes.forEach((manga) => {
const tmp = tmpSources.find((source) => source.id === manga.sourceId);
if (!tmp) {
tmpSources.push({
id: manga.sourceId,
displayName: manga.sourceId,
iconUrl: '',
lang: '',
broken: true,
mangas: {
TotalCount: 1
},
meta: []
});
return;
}
if (tmp.mangas) tmp.mangas.TotalCount += 1;
else tmp.mangas = { TotalCount: 1 };
const tmpSources = untrack(() => {
const tmpSources: sourceWithMangaCount[] = data.sources.nodes;
data.mangas.nodes.forEach((manga) => {
const tmp = tmpSources.find((source) => source.id === manga.sourceId);
if (!tmp) {
tmpSources.push({
id: manga.sourceId,
displayName: manga.sourceId,
iconUrl: '',
lang: '',
broken: true,
mangas: {
TotalCount: 1
},
meta: []
});
return;
}
if (tmp.mangas) tmp.mangas.TotalCount += 1;
else tmp.mangas = { TotalCount: 1 };
});
return tmpSources;
});
return tmpSources.filter((e) => e.mangas?.TotalCount);
}
Expand Down

0 comments on commit 8d7ca49

Please sign in to comment.