From 205e4a84365c837f95601ad0a5324674a50d89ea Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 14 Sep 2023 09:31:23 +0800 Subject: [PATCH] :art: Improve update tx --- kernel/model/transaction.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/kernel/model/transaction.go b/kernel/model/transaction.go index c5d72351d..921bc1306 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)