🎨 Improve status bar index creation information prompt https://github.com/siyuan-note/siyuan/issues/15390

This commit is contained in:
Daniel 2025-07-30 11:10:26 +08:00
parent b358d4b70f
commit 2f57e57b92
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 14 additions and 8 deletions

View file

@ -676,7 +676,14 @@ func FullReindex() {
task.AppendTask(task.ReloadUI, util.ReloadUI)
}
var fullReindexing bool
func fullReindex() {
fullReindexing = true
defer func() {
fullReindexing = false
}()
util.PushEndlessProgress(Conf.language(35))
defer util.PushClearProgress()

View file

@ -368,6 +368,12 @@ func subscribeSQLEvents() {
// util.ContextPushMsg(context, msg)
//})
eventbus.Subscribe(eventbus.EvtSQLInsertBlocksFTS, func(context map[string]interface{}, blockCount int, hash string) {
if !fullReindexing {
// 如果不是全量重建索引,则不显示进度信息
// Improve status bar index creation information prompt https://github.com/siyuan-note/siyuan/issues/15390
return
}
current := context["current"].(int)
total := context["total"]
msg := fmt.Sprintf(Conf.Language(90), current, total, blockCount, hash)

View file

@ -54,7 +54,6 @@ import (
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/conf"
"github.com/siyuan-note/siyuan/kernel/filesys"
"github.com/siyuan-note/siyuan/kernel/sql"
"github.com/siyuan-note/siyuan/kernel/task"
"github.com/siyuan-note/siyuan/kernel/treenode"
"github.com/siyuan-note/siyuan/kernel/util"
@ -772,13 +771,7 @@ func checkoutRepo(id string) {
return
}
task.AppendTask(task.DatabaseIndexFull, fullReindex)
task.AppendTask(task.DatabaseIndexRef, IndexRefs)
go func() {
sql.FlushQueue()
ResetVirtualBlockRefCache()
}()
task.AppendTask(task.ReloadUI, util.ReloadUIResetScroll)
FullReindex()
if syncEnabled {
task.AppendAsyncTaskWithDelay(task.PushMsg, 7*time.Second, util.PushMsg, Conf.Language(134), 0)