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);