Fix tracker search results missing bound track record
There is a possibility that the source changed the manga title after the track record was bound. In that case it is possible that the track record won't be found anymore when executing the search. Thus, instead of using the manga title as the search string, the existing track records title should be used instead to make sure that the bound track record will be included in the search results.
This commit is contained in:
@@ -117,16 +117,18 @@ export const TrackerSearch = ({
|
|||||||
tracker,
|
tracker,
|
||||||
closeSearchMode,
|
closeSearchMode,
|
||||||
trackedId,
|
trackedId,
|
||||||
|
trackedTitle,
|
||||||
}: {
|
}: {
|
||||||
manga: MangaIdInfo & Pick<MangaType, 'title'>;
|
manga: MangaIdInfo & Pick<MangaType, 'title'>;
|
||||||
tracker: TTrackerBind;
|
tracker: TTrackerBind;
|
||||||
closeSearchMode: () => void;
|
closeSearchMode: () => void;
|
||||||
trackedId?: string;
|
trackedId?: string;
|
||||||
|
trackedTitle?: string;
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useLingui();
|
const { t } = useLingui();
|
||||||
const getOptionForDirection = useGetOptionForDirection();
|
const getOptionForDirection = useGetOptionForDirection();
|
||||||
|
|
||||||
const [searchString, setSearchString] = useState<string>(manga.title);
|
const [searchString, setSearchString] = useState<string>(trackedTitle ?? manga.title);
|
||||||
const [tmpSearchString, setTmpSearchString] = useState(searchString);
|
const [tmpSearchString, setTmpSearchString] = useState(searchString);
|
||||||
|
|
||||||
const [selectedTrackerRemoteId, setSelectedTrackerRemoteId] = useState<string | undefined>(trackedId);
|
const [selectedTrackerRemoteId, setSelectedTrackerRemoteId] = useState<string | undefined>(trackedId);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ export const TrackerCard = ({
|
|||||||
manga={manga}
|
manga={manga}
|
||||||
tracker={tracker}
|
tracker={tracker}
|
||||||
trackedId={trackRecord?.remoteId}
|
trackedId={trackRecord?.remoteId}
|
||||||
|
trackedTitle={trackRecord?.title}
|
||||||
closeSearchMode={() => setSearchMode(undefined)}
|
closeSearchMode={() => setSearchMode(undefined)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user