From 6015b7a84bd31a3fe58a88ebd15df2f953b18ecd Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sun, 21 Jun 2026 13:17:13 +0200 Subject: [PATCH] Reset search/migration state on retry When resuming a migration search, it was possible that an entry search was partially done. In this case, when retrying, the sources with search results were not retried. If all retried source searches failed, it was incorrectly treated as if all source searches failed, since it only considers the actually executed search sources, which only included failed/pending sources. --- CHANGELOG.md | 1 + src/features/migration/MigrationManager.ts | 26 +++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2356ad4..6c5fbe84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - (**Migration**) Fix selecting a destination from a source browse search page - (**Migration**) Fix being able to migrate an entry to itself - (**Migration**) Fix resuming migration when app is opened in multiple tabs +- (**Migration**) Fix showing "All source searches failed" error while the entry has a selected destination source or matches were found - (**Reader**) Fix scrollbar appearing with "fit to widt/height/screen" page scale mode and applied safe area insets - (**Reader**) Fix wrongly positioned mobile progress bar current page indicator - (**Reader**) Fix mobile progress bar previous/next chapter button visibility on hover and while disabled diff --git a/src/features/migration/MigrationManager.ts b/src/features/migration/MigrationManager.ts index a27a51fd..178edb40 100644 --- a/src/features/migration/MigrationManager.ts +++ b/src/features/migration/MigrationManager.ts @@ -74,6 +74,7 @@ import { AppSession } from '@/base/AppSession.ts'; import { ControlledPromise } from '@/lib/ControlledPromise.ts'; import { d } from 'koration'; import merge from 'lodash/fp/merge'; +import mapValues from 'lodash/fp/mapValues'; const RESUMABLE_PHASES: readonly MigrationPhase[] = [MigrationPhase.SEARCHING, MigrationPhase.MIGRATING]; @@ -912,7 +913,17 @@ export class MigrationManager { MigrationManager.abortControllerByManga.set(mangaId, searchController); MigrationManager.updateState((draft) => { - draft.entries[mangaId].status = MigrationEntryStatus.SEARCHING; + const draftEntry = draft.entries[mangaId]; + + draftEntry.status = MigrationEntryStatus.SEARCHING; + draftEntry.error = undefined; + draftEntry.searchMatches = []; + draftEntry.manualMatches = []; + draftEntry.isManualSelection = false; + draftEntry.selectedMatchMangaId = null; + draftEntry.selectedMatchSourceId = null; + draftEntry.areMatchesExpanded = false; + draftEntry.destSourceIdToSearchState = mapValues(() => false, draftEntry.destSourceIdToSearchState); }); try { @@ -1117,7 +1128,10 @@ export class MigrationManager { MigrationManager.abortControllerByManga.set(mangaId, migrateController); MigrationManager.updateState((draft) => { - draft.entries[mangaId].status = MigrationEntryStatus.MIGRATING; + const draftEntry = draft.entries[mangaId]; + + draftEntry.status = MigrationEntryStatus.MIGRATING; + draftEntry.error = undefined; }); try { @@ -1178,9 +1192,7 @@ export class MigrationManager { if (MigrationEntries.hasStatus(entry, MigrationEntryStatus.SEARCH_FAILED)) { MigrationManager.updateState((draft) => { - const draftEntry = draft.entries[id]; - draftEntry.status = MigrationEntryStatus.SEARCH_PENDING; - draftEntry.error = undefined; + draft.entries[id].status = MigrationEntryStatus.SEARCH_PENDING; }); assertIsDefined(searchOptions); @@ -1194,9 +1206,7 @@ export class MigrationManager { if (MigrationEntries.hasStatus(entry, MigrationEntryStatus.MIGRATION_FAILED)) { MigrationManager.updateState((draft) => { - const draftEntry = draft.entries[id]; - draftEntry.status = MigrationEntryStatus.MIGRATION_PENDING; - draftEntry.error = undefined; + draft.entries[id].status = MigrationEntryStatus.MIGRATION_PENDING; }); assertIsDefined(migrateOptions);