mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
🐛 Two-way relation is invalid when related to the current database https://github.com/siyuan-note/siyuan/issues/11278
This commit is contained in:
parent
6af0432145
commit
8e27532c44
1 changed files with 13 additions and 4 deletions
|
|
@ -3255,7 +3255,14 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string,
|
|||
if nil != key && av.KeyTypeRelation == key.Type && nil != key.Relation && key.Relation.IsTwoWay {
|
||||
// 双向关联需要同时更新目标字段的值
|
||||
|
||||
if destAv, _ := av.ParseAttributeView(key.Relation.AvID); nil != destAv {
|
||||
var destAv *av.AttributeView
|
||||
if avID == key.Relation.AvID {
|
||||
destAv = attrView
|
||||
} else {
|
||||
destAv, _ = av.ParseAttributeView(key.Relation.AvID)
|
||||
}
|
||||
|
||||
if nil != destAv {
|
||||
// relationChangeMode
|
||||
// 0:关联列值不变(仅排序),不影响目标值
|
||||
// 1:关联列值增加,增加目标值
|
||||
|
|
@ -3307,9 +3314,11 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string,
|
|||
}
|
||||
}
|
||||
|
||||
if destAv != attrView {
|
||||
av.SaveAttributeView(destAv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
relatedAvIDs := av.GetSrcAvIDs(avID)
|
||||
for _, relatedAvID := range relatedAvIDs {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue