From a3bed57fbb28a89e2accabbd9c29490b908f849c Mon Sep 17 00:00:00 2001 From: AdingApkgg Date: Fri, 26 Dec 2025 21:17:01 +0800 Subject: [PATCH] Fix filter structure in fetchVndbQuotes and enhance screenshot validation in VndbPanel.vue - Updated the filter format in fetchVndbQuotes to directly use vnId for improved clarity. - Added a check in VndbPanel.vue to ensure the current game ID matches before processing screenshots, preventing unnecessary updates. --- src/api/search.ts | 2 +- src/components/VndbPanel.vue | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/search.ts b/src/api/search.ts index 4ac52dd..1d80039 100644 --- a/src/api/search.ts +++ b/src/api/search.ts @@ -598,7 +598,7 @@ export async function fetchVndbQuotes(vnId: string): Promise { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ - filters: ['vn', '=', ['id', '=', vnId]], + filters: ['vn', '=', vnId], fields: 'id, quote, character{id, name, original}', results: 10, }), diff --git a/src/components/VndbPanel.vue b/src/components/VndbPanel.vue index fea07df..631a722 100644 --- a/src/components/VndbPanel.vue +++ b/src/components/VndbPanel.vue @@ -730,8 +730,13 @@ watch(() => searchStore.vndbInfo, async (newInfo) => { // 检查缓存的截图是否已加载 if (newInfo?.screenshots && newInfo.screenshots.length > 0) { + const vnIdForScreenshots = newInfo.id nextTick(() => { requestAnimationFrame(() => { + // 检查是否仍是同一个游戏 + if (currentVnId.value !== vnIdForScreenshots) { + return + } const screenshotImgs = modalRef.value?.querySelectorAll('img[alt*="截图"]') if (screenshotImgs) { for (let i = 0; i < screenshotImgs.length; i++) {