🎨 Update av

This commit is contained in:
Daniel 2023-07-01 12:13:58 +08:00
parent 86c177e03c
commit 550b4bcae7
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 17 additions and 7 deletions

View file

@ -30,12 +30,12 @@ type Cell struct {
}
type Value struct {
Block *ValueBlock `json:"block"`
Text *ValueText `json:"text"`
Number *ValueNumber `json:"number"`
Date *ValueDate `json:"date"`
Select *ValueSelect `json:"select"`
MSelect []*ValueSelect `json:"mSelect"`
Block *ValueBlock `json:"block,omitempty"`
Text *ValueText `json:"text,omitempty"`
Number *ValueNumber `json:"number,omitempty"`
Date *ValueDate `json:"date,omitempty"`
Select *ValueSelect `json:"select,omitempty"`
MSelect []*ValueSelect `json:"mSelect,omitempty"`
}
func (value *Value) ToJSONString() string {

View file

@ -1116,6 +1116,7 @@ func refreshDynamicRefText(updatedDefNode *ast.Node, updatedTree *parse.Tree) {
// refreshDynamicRefTexts 用于批量刷新引用块的动态锚文本。
// 该实现依赖了数据库缓存,导致外部调用时可能需要阻塞等待数据库写入后才能获取到 refs
func refreshDynamicRefTexts(updatedDefNodes map[string]*ast.Node, updatedTrees map[string]*parse.Tree) {
// 1. 更新引用的动态锚文本
treeRefNodeIDs := map[string]*hashset.Set{}
for _, updateNode := range updatedDefNodes {
refs := sql.GetRefsCacheByDefID(updateNode.ID)
@ -1146,6 +1147,8 @@ func refreshDynamicRefTexts(updatedDefNodes map[string]*ast.Node, updatedTrees m
}
}
changedRefTree := map[string]*parse.Tree{}
for refTreeID, refNodeIDs := range treeRefNodeIDs {
refTree, ok := updatedTrees[refTreeID]
if !ok {
@ -1173,9 +1176,16 @@ func refreshDynamicRefTexts(updatedDefNodes map[string]*ast.Node, updatedTrees m
})
if refTreeChanged {
indexWriteJSONQueue(refTree)
changedRefTree[refTreeID] = refTree
}
}
// 2. 更新属性视图主键内容
// 3. 保存变更
for _, tree := range changedRefTree {
indexWriteJSONQueue(tree)
}
}
var updateRefTextRenameDocs = map[string]*parse.Tree{}