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/15533

Danielc3cd7b96a054
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index 92dce434f6..b6fb8d1600 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -4229,6 +4229,19 @@ func updateAttributeViewValue(tx *Transaction, attrView *av.AttributeView, keyID
}
} else if av.KeyTypeSelect == val.Type || av.KeyTypeMSelect == val.Type {
if nil != key && 0 < len(val.MSelect) {
+ var tmp []*av.ValueSelect
+ // 移除空选项 https://github.com/siyuan-note/siyuan/issues/15533
+ for _, v := range val.MSelect {
+ if "" != v.Content {
+ tmp = append(tmp, v)
+ }
+ }
+ val.MSelect = tmp
+
+ if 1 > len(val.MSelect) {
+ return
+ }
+
// The selection options are inconsistent after pasting data into the database https://github.com/siyuan-note/siyuan/issues/11409
for _, valOpt := range val.MSelect {
if opt := key.GetOption(valOpt.Content); nil == opt {
@@ -4551,6 +4564,18 @@ func updateAttributeViewColumnOptions(operation *Operation) (err error) {
return
}
+ // 移除空选项 https://github.com/siyuan-note/siyuan/issues/15533
+ var tmp []*av.SelectOption
+ for _, opt := range options {
+ if "" != opt.Name {
+ tmp = append(tmp, opt)
+ }
+ }
+ options = tmp
+ if 1 > len(options) {
+ return
+ }
+
for _, keyValues := range attrView.KeyValues {
if keyValues.Key.ID == operation.ID {
keyValues.Key.Options = options