Skip to content

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

:art: Improve update tx

Daniel205e4a84365c
diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go
index c5d72351d7..921bc13063 100644
--- a/kernel/model/transaction.go
+++ b/kernel/model/transaction.go
@@ -454,9 +454,9 @@ func (tx *Transaction) doPrependInsert(operation *Operation) (ret *TxErr) {
var err error
block := treenode.GetBlockTree(operation.ParentID)
if nil == block {
- msg := fmt.Sprintf("not found parent block [%s]", operation.ParentID)
- logging.LogErrorf(msg)
- return &TxErr{code: TxErrCodeBlockNotFound, id: operation.ParentID}
+ logging.LogErrorf("not found parent block [%s]", operation.ParentID)
+ util.ReloadUI() // 比如分屏后编辑器状态不一致,这里强制重新载入界面
+ return
}
tree, err := tx.loadTree(block.ID)
if nil != err {
@@ -538,9 +538,9 @@ func (tx *Transaction) doAppendInsert(operation *Operation) (ret *TxErr) {
var err error
block := treenode.GetBlockTree(operation.ParentID)
if nil == block {
- msg := fmt.Sprintf("not found parent block [%s]", operation.ParentID)
- logging.LogErrorf(msg)
- return &TxErr{code: TxErrCodeBlockNotFound, id: operation.ParentID}
+ logging.LogErrorf("not found parent block [%s]", operation.ParentID)
+ util.ReloadUI() // 比如分屏后编辑器状态不一致,这里强制重新载入界面
+ return
}
tree, err := tx.loadTree(block.ID)
if nil != err {
@@ -779,9 +779,9 @@ func (tx *Transaction) doInsert(operation *Operation) (ret *TxErr) {
}
}
if nil == block {
- msg := fmt.Sprintf("not found next block [%s]", operation.NextID)
- logging.LogErrorf(msg)
- return &TxErr{code: TxErrCodeBlockNotFound, id: operation.NextID}
+ logging.LogErrorf("not found block [%s, %s, %s]", operation.ParentID, operation.PreviousID, operation.NextID)
+ util.ReloadUI() // 比如分屏后编辑器状态不一致,这里强制重新载入界面
+ return
}
tree, err := tx.loadTree(block.ID)