From 3b1b62fb7ef27c6299ce3ca978a933a80d0a0bf7 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Mon, 12 Dec 2022 22:27:48 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=94=AF=E6=8C=81=E5=88=97=E5=87=BA?= =?UTF-8?q?=E5=92=8C=E5=88=87=E6=8D=A2=E6=9C=80=E8=BF=91=E6=89=93=E5=BC=80?= =?UTF-8?q?=E7=9A=84=E6=96=87=E6=A1=A3=20https://github.com/siyuan-note/si?= =?UTF-8?q?yuan/issues/3293?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/storage.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/kernel/model/storage.go b/kernel/model/storage.go index 0851989e4..813bb72dc 100644 --- a/kernel/model/storage.go +++ b/kernel/model/storage.go @@ -80,17 +80,14 @@ func SetRecentDoc(doc *RecentDoc) (err error) { return } - update := false for i, c := range recentDocs { if c.RootID == doc.RootID { - recentDocs[i] = doc - update = true + recentDocs = append(recentDocs[:i], recentDocs[i+1:]...) break } } - if !update { - recentDocs = append([]*RecentDoc{doc}, recentDocs...) - } + + recentDocs = append([]*RecentDoc{doc}, recentDocs...) if 32 < len(recentDocs) { recentDocs = recentDocs[:32] }