Skip to content

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

:art: https://github.com/siyuan-note/siyuan/pull/15157

Daniel26524dfd15dc
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index b34c5a2921..2954857d6e 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -148,12 +148,12 @@ func ChangeAttrViewLayout(blockID, avID string, layout av.LayoutType) (err error
}
view.LayoutType = newLayout
- err = av.SaveAttributeView(attrView)
blockIDs := treenode.GetMirrorAttrViewBlockIDs(avID)
- for _, blockID := range blockIDs {
- node, tree, err := getNodeByBlockID(nil, blockID)
- if err != nil {
+ for _, bID := range blockIDs {
+ node, tree, _ := getNodeByBlockID(nil, bID)
+ if nil == node || nil == tree {
+ logging.LogErrorf("get node by block ID [%s] failed", bID)
continue
}
@@ -162,10 +162,16 @@ func ChangeAttrViewLayout(blockID, avID string, layout av.LayoutType) (err error
attrs[av.NodeAttrView] = view.ID
err = setNodeAttrs(node, tree, attrs)
if err != nil {
- logging.LogWarnf("set node [%s] attrs failed: %s", blockID, err)
+ logging.LogWarnf("set node [%s] attrs failed: %s", bID, err)
+ return
}
}
+ if err = av.SaveAttributeView(attrView); nil != err {
+ logging.LogErrorf("save attribute view [%s] failed: %s", avID, err)
+ return
+ }
+
ReloadAttrView(avID)
return
}