Fix selecting migration destination from source browse search page

When going to the source search from the global search, the manga card mode wasn't passed, which prevented a manga from getting selected as the migration destination

#1110
This commit is contained in:
schroda
2026-05-27 22:28:28 +02:00
parent 27c87185b1
commit 278ebb312f
9 changed files with 54 additions and 25 deletions

View File

@@ -16,7 +16,7 @@ import type {
SourcePreferenceChangeInput,
SourceType,
} from '@/lib/graphql/generated/graphql-base.types.ts';
import type { MangaCardMode } from '@/features/manga/Manga.types.ts';
import type { MangaCardMode, MangaIdInfo } from '@/features/manga/Manga.types.ts';
export interface IPos {
type: 'selectState' | 'textState' | 'checkBoxState' | 'triState' | 'sortState';
@@ -86,4 +86,5 @@ export interface RouteStateSourceBrowse {
contentType?: SourceContentType;
clearCache?: boolean;
mode?: MangaCardMode;
mangaId?: MangaIdInfo['id'];
}

View File

@@ -58,6 +58,8 @@ import { useAppTitleAndAction } from '@/features/navigation-bar/hooks/useAppTitl
import { useNavBarContext } from '@/features/navigation-bar/NavbarContext.tsx';
import { VirtuosoUtil } from '@/lib/virtuoso/Virtuoso.util.tsx';
import { IconWebView } from '@/assets/icons/IconWebView.tsx';
import { MigrationManager } from '@/features/migration/MigrationManager.ts';
import { ReactRouter } from '@/lib/react-router/ReactRouter.ts';
const DEFAULT_SOURCE: SourceIdInfo = { id: '-1' };
@@ -216,6 +218,8 @@ export function SourceMangas() {
const {
contentType: initialContentType = SourceContentType.POPULAR,
clearCache = false,
mode = 'source',
mangaId,
} = useLocation<RouteStateSourceBrowse>().state ?? STABLE_EMPTY_OBJECT;
const {
@@ -485,8 +489,20 @@ export function SourceMangas() {
messageExtra={messageExtra}
isLoading={isLoading}
gridLayout={sourceGridLayout}
mode="source"
mode={mode}
inLibraryIndicator
onMigrateSelect={
mangaId
? (match) => {
MigrationManager.selectManualMatch(mangaId, {
...match,
sourceTitle: Sources.getFromCache(match.sourceId)?.displayName,
latestChapterNumber: undefined,
});
ReactRouter.navigate(AppRoutes.migrate.path);
}
: undefined
}
/>
)}
{error && (