Improve database group view performance https://github.com/siyuan-note/siyuan/issues/15811

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2025-09-10 16:49:53 +08:00
parent 9a15b466f3
commit de19d69f99
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -97,14 +97,14 @@ func renderAttributeViewGroups(viewable av.Viewable, attrView *av.AttributeView,
if isGroupByDate(view) { if isGroupByDate(view) {
createdDate := time.UnixMilli(view.GroupCreated).Format("2006-01-02") createdDate := time.UnixMilli(view.GroupCreated).Format("2006-01-02")
if time.Now().Format("2006-01-02") != createdDate { if time.Now().Format("2006-01-02") != createdDate {
regenAttrViewGroups(attrView) genAttrViewGroups(view, attrView) // 仅重新生成一个视图的分组以提升性能
av.SaveAttributeView(attrView) av.SaveAttributeView(attrView)
} }
} }
// 如果是按模板分组则需要重新生成分组 // 如果是按模板分组则需要重新生成分组
if isGroupByTemplate(attrView, view) { if isGroupByTemplate(attrView, view) {
regenAttrViewGroups(attrView) genAttrViewGroups(view, attrView) // 仅重新生成一个视图的分组以提升性能
av.SaveAttributeView(attrView) av.SaveAttributeView(attrView)
} }