This commit is contained in:
Liang Ding 2022-12-23 16:26:28 +08:00
parent 7ef54b0f8f
commit 3f518547f8
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -972,18 +972,29 @@ func syncRepo(exit, byHand bool) (err error) {
// 有数据变更,需要重建索引
var upserts, removes []string
var upsertTrees int
var needReloadFlashcard bool
for _, file := range mergeResult.Upserts {
upserts = append(upserts, file.Path)
if strings.HasPrefix(file.Path, "/storage/riff/") {
needReloadFlashcard = true
}
if strings.HasSuffix(file.Path, ".sy") {
upsertTrees++
}
}
for _, file := range mergeResult.Removes {
removes = append(removes, file.Path)
if strings.HasPrefix(file.Path, "/storage/riff/") {
needReloadFlashcard = true
}
}
cache.ClearDocsIAL() // 同步后文档树文档图标没有更新 https://github.com/siyuan-note/siyuan/issues/4939
if needReloadFlashcard {
InitFlashcards()
}
cache.ClearDocsIAL() // 同步后文档树文档图标没有更新 https://github.com/siyuan-note/siyuan/issues/4939
if needFullReindex(upsertTrees) { // 改进同步后全量重建索引判断 https://github.com/siyuan-note/siyuan/issues/5764
FullReindex()
return