From 70d0246668971aa542830057616f3a327a3f1de8 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 8 Dec 2024 17:52:00 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/13343 --- app/src/search/util.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/search/util.ts b/app/src/search/util.ts index 391c639fb..60a18e940 100644 --- a/app/src/search/util.ts +++ b/app/src/search/util.ts @@ -1200,7 +1200,7 @@ const renderNextSearchMark = (options: { } }; -let reqId: number +let articleId: string export const getArticle = (options: { id: string, @@ -1208,14 +1208,20 @@ export const getArticle = (options: { edit: Protyle value?: string, }) => { + articleId = options.id checkFold(options.id, (zoomIn) => { + if (articleId !== options.id) { + return; + } options.edit.protyle.scroll.lastScrollTop = 0; addLoading(options.edit.protyle); fetchPost("/api/block/getDocInfo", { id: options.id, }, (response) => { + if (articleId !== options.id) { + return; + } options.edit.protyle.wysiwyg.renderCustom(response.data.ial); - reqId = new Date().getTime() fetchPost("/api/filetree/getDoc", { id: options.id, query: options.value || null, @@ -1225,9 +1231,8 @@ export const getArticle = (options: { size: zoomIn ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks, zoom: zoomIn, highlight: !isSupportCSSHL(), - reqId }, getResponse => { - if (reqId > response.data.reqId) { + if (articleId !== options.id) { return; } options.edit.protyle.query = {