🎨 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) task.AppendTask(task.ReloadUI, util.ReloadUI)
} }
var fullReindexing bool
func fullReindex() { func fullReindex() {
fullReindexing = true
defer func() {
fullReindexing = false
}()
util.PushEndlessProgress(Conf.language(35)) util.PushEndlessProgress(Conf.language(35))
defer util.PushClearProgress() defer util.PushClearProgress()

View file

@ -368,6 +368,12 @@ func subscribeSQLEvents() {
// util.ContextPushMsg(context, msg) // util.ContextPushMsg(context, msg)
//}) //})
eventbus.Subscribe(eventbus.EvtSQLInsertBlocksFTS, func(context map[string]interface{}, blockCount int, hash string) { 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) current := context["current"].(int)
total := context["total"] total := context["total"]
msg := fmt.Sprintf(Conf.Language(90), current, total, blockCount, hash) 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/logging"
"github.com/siyuan-note/siyuan/kernel/conf" "github.com/siyuan-note/siyuan/kernel/conf"
"github.com/siyuan-note/siyuan/kernel/filesys" "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/task"
"github.com/siyuan-note/siyuan/kernel/treenode" "github.com/siyuan-note/siyuan/kernel/treenode"
"github.com/siyuan-note/siyuan/kernel/util" "github.com/siyuan-note/siyuan/kernel/util"
@ -772,13 +771,7 @@ func checkoutRepo(id string) {
return return
} }
task.AppendTask(task.DatabaseIndexFull, fullReindex) FullReindex()
task.AppendTask(task.DatabaseIndexRef, IndexRefs)
go func() {
sql.FlushQueue()
ResetVirtualBlockRefCache()
}()
task.AppendTask(task.ReloadUI, util.ReloadUIResetScroll)
if syncEnabled { if syncEnabled {
task.AppendAsyncTaskWithDelay(task.PushMsg, 7*time.Second, util.PushMsg, Conf.Language(134), 0) task.AppendAsyncTaskWithDelay(task.PushMsg, 7*time.Second, util.PushMsg, Conf.Language(134), 0)