🎨 Improve database primary key content update for bound container blocks https://github.com/siyuan-note/siyuan/issues/12664

This commit is contained in:
Daniel 2024-10-11 14:55:32 +08:00
parent 40abcee32d
commit 49f1440ff4
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -236,11 +236,8 @@ func refreshDynamicRefTexts(updatedDefNodes map[string]*ast.Node, updatedTrees m
// 2. 更新属性视图主键内容 // 2. 更新属性视图主键内容
var parents []*ast.Node var parents []*ast.Node
for _, updatedDefNode := range updatedDefNodes { for _, updatedDefNode := range updatedDefNodes {
parent := updatedDefNode.Parent for parent := updatedDefNode.Parent; nil != parent && ast.NodeDocument != parent.Type; parent = parent.Parent {
for ; nil != parent && ast.NodeDocument != parent.Type && parent.IsContainerBlock(); parent = parent.Parent { parents = append(parents, parent)
if ast.NodeDocument != parent.Type && parent.IsContainerBlock() && treenode.FirstLeafBlock(parent) == updatedDefNode {
parents = append(parents, parent)
}
} }
} }
for _, parent := range parents { for _, parent := range parents {
@ -248,10 +245,6 @@ func refreshDynamicRefTexts(updatedDefNodes map[string]*ast.Node, updatedTrees m
} }
for _, updatedDefNode := range updatedDefNodes { for _, updatedDefNode := range updatedDefNodes {
if nil != updatedDefNode.Parent && ast.NodeDocument != updatedDefNode.Parent.Type &&
updatedDefNode.Parent.IsContainerBlock() && treenode.FirstLeafBlock(updatedDefNode.Parent) == updatedDefNode {
updatedDefNode = updatedDefNode.Parent
}
avs := updatedDefNode.IALAttr(av.NodeAttrNameAvs) avs := updatedDefNode.IALAttr(av.NodeAttrNameAvs)
if "" == avs { if "" == avs {
continue continue