fix: prefer select

This commit is contained in:
shinya
2025-07-16 18:38:05 +08:00
parent 1cd7ad3b7b
commit af2d257344
2 changed files with 49 additions and 2 deletions

View File

@@ -540,8 +540,23 @@ function PlayPageClient() {
}
let detailData: SearchResult = sourcesInfo[0];
// 指定源和id且无需优选
if (currentSource && currentId && !needPreferRef.current) {
const target = sourcesInfo.find(
(source) => source.source === currentSource && source.id === currentId
);
if (target) {
detailData = target;
} else {
setError('未找到匹配结果');
setLoading(false);
return;
}
}
// 未指定源和 id 或需要优选,且开启优选开关
if (
((!currentSource && !currentId) || needPreferRef.current) &&
(!currentSource || !currentId || needPreferRef.current) &&
optimizationEnabled
) {
setLoadingStage('preferring');
@@ -550,7 +565,6 @@ function PlayPageClient() {
detailData = await preferBestSource(sourcesInfo);
}
console.log(sourcesInfo);
console.log(detailData.source, detailData.id);
setNeedPrefer(false);