mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-20 22:14:06 +01:00
⚡ Improve performance for large-scale block deletion/insertion https://github.com/siyuan-note/siyuan/issues/16644
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
80faba6c75
commit
89952fa8b4
6 changed files with 181 additions and 217 deletions
|
|
@ -61,11 +61,9 @@ func (tx *Transaction) doFoldHeading(operation *Operation) (ret *TxErr) {
|
|||
})
|
||||
}
|
||||
heading.SetIALAttr("fold", "1")
|
||||
if err = tx.writeTree(tree); err != nil {
|
||||
return &TxErr{code: TxErrCodeWriteTree, msg: err.Error(), id: headingID}
|
||||
}
|
||||
IncSync()
|
||||
|
||||
tx.writeTree(tree)
|
||||
IncSync()
|
||||
cache.PutBlockIAL(headingID, parse.IAL2Map(heading.KramdownIAL))
|
||||
for _, child := range children {
|
||||
cache.PutBlockIAL(child.ID, parse.IAL2Map(child.KramdownIAL))
|
||||
|
|
@ -126,9 +124,8 @@ func (tx *Transaction) doUnfoldHeading(operation *Operation) (ret *TxErr) {
|
|||
}
|
||||
heading.RemoveIALAttr("fold")
|
||||
heading.RemoveIALAttr("heading-fold")
|
||||
if err = tx.writeTree(tree); err != nil {
|
||||
return &TxErr{code: TxErrCodeWriteTree, msg: err.Error(), id: headingID}
|
||||
}
|
||||
|
||||
tx.writeTree(tree)
|
||||
IncSync()
|
||||
|
||||
cache.PutBlockIAL(headingID, parse.IAL2Map(heading.KramdownIAL))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue