修复懒加载问题

This commit is contained in:
mtvpls
2026-03-21 23:41:10 +08:00
parent e7e4196e2e
commit 5b6649ce2f
+7 -7
View File
@@ -2116,8 +2116,8 @@ function PlayPageClient() {
!detailData.episodes || !detailData.episodes ||
episodeIndex >= detailData.episodes.length episodeIndex >= detailData.episodes.length
) { ) {
// 这类源统一先走详情懒加载 // 这类源统一先走详情懒加载,如果 episodes 为空则跳过
if (isLazyDetailSource(detailData?.source)) { if (isLazyDetailSource(detailData?.source) && (!detailData.episodes || detailData.episodes.length === 0)) {
return; return;
} }
setVideoUrl(''); setVideoUrl('');
@@ -3391,7 +3391,7 @@ function PlayPageClient() {
detailData = target; detailData = target;
// 这类源统一通过详情接口补全播放数据 // 这类源统一通过详情接口补全播放数据
if (isLazyDetailSource(detailData.source)) { if (isLazyDetailSource(detailData.source) && (!detailData.episodes || detailData.episodes.length === 0)) {
console.log('[Play] Fetching lazy detail for selected source...'); console.log('[Play] Fetching lazy detail for selected source...');
// currentSource 已经是完整格式 // currentSource 已经是完整格式
const detailSources = await fetchSourceDetail(currentSource, currentId, searchTitle || videoTitle); const detailSources = await fetchSourceDetail(currentSource, currentId, searchTitle || videoTitle);
@@ -3452,7 +3452,7 @@ function PlayPageClient() {
console.log(detailData.source, detailData.id); console.log(detailData.source, detailData.id);
// 这类源统一通过详情接口补全播放数据 // 这类源统一通过详情接口补全播放数据
if (isLazyDetailSource(detailData.source)) { if (isLazyDetailSource(detailData.source) && (!detailData.episodes || detailData.episodes.length === 0)) {
console.log('[Play] Fetching lazy detail after source selection...'); console.log('[Play] Fetching lazy detail after source selection...');
const detailSources = await fetchSourceDetail(detailData.source, detailData.id, detailData.title || videoTitleRef.current); const detailSources = await fetchSourceDetail(detailData.source, detailData.id, detailData.title || videoTitleRef.current);
if (detailSources.length > 0) { if (detailSources.length > 0) {
@@ -3769,7 +3769,7 @@ function PlayPageClient() {
} }
// 这类源统一通过详情接口补全播放数据 // 这类源统一通过详情接口补全播放数据
if (isLazyDetailSource(newDetail.source)) { if (isLazyDetailSource(newDetail.source) && (!newDetail.episodes || newDetail.episodes.length === 0)) {
try { try {
const detailResponse = await fetch(`/api/source-detail?source=${newSource}&id=${newId}&title=${encodeURIComponent(newTitle)}`); const detailResponse = await fetch(`/api/source-detail?source=${newSource}&id=${newId}&title=${encodeURIComponent(newTitle)}`);
if (detailResponse.ok) { if (detailResponse.ok) {
@@ -5077,8 +5077,8 @@ function PlayPageClient() {
return; return;
} }
// 这类源会先异步补全详情,这里先跳过 // 这类源会先异步补全详情,如果 episodes 为空则跳过
if (isLazyDetailSource(currentSource || detail?.source)) { if (isLazyDetailSource(currentSource || detail?.source) && (!detail || !detail.episodes || detail.episodes.length === 0)) {
return; return;
} }