Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve av https://github.com/siyuan-note/siyuan/issues/15572

Danielae54b3edc08a
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index e1280793db..1de2c21d2b 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -4724,6 +4724,12 @@ func updateAttributeViewColumnOptions(operation *Operation) (err error) {
return
}
+ optionSorts := map[string]int{}
+ for i, opt := range options {
+ optionSorts[opt.Name] = i
+ }
+
+ addNew := false
selectKey, _ := attrView.GetKey(operation.ID)
if nil == selectKey {
return
@@ -4744,9 +4750,16 @@ func updateAttributeViewColumnOptions(operation *Operation) (err error) {
Color: opt.Color,
Desc: opt.Desc,
})
+ addNew = true
}
}
+ if !addNew {
+ sort.SliceStable(selectKey.Options, func(i, j int) bool {
+ return optionSorts[selectKey.Options[i].Name] < optionSorts[selectKey.Options[j].Name]
+ })
+ }
+
regenAttrViewGroups(attrView, operation.ID)
err = av.SaveAttributeView(attrView)
return