From 71dd27c62a41a0c6a613b0a30927bd30c0fb8718 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 26 Oct 2023 19:57:25 +0800 Subject: [PATCH] :art: Adding row overwriting data after enabling sort in database Fix https://github.com/siyuan-note/siyuan/issues/9517 --- kernel/av/table.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/av/table.go b/kernel/av/table.go index 0342b50ca..0c0963c73 100644 --- a/kernel/av/table.go +++ b/kernel/av/table.go @@ -610,6 +610,11 @@ func (table *Table) SortRows() { } sort.Slice(table.Rows, func(i, j int) bool { + block := table.Rows[i].GetBlockValue() + if !block.IsInitialized && nil != block.Block && "" == block.Block.Content && block.IsDetached { + return false + } + for _, colIndexSort := range colIndexSorts { result := table.Rows[i].Cells[colIndexSort.Index].Value.Compare(table.Rows[j].Cells[colIndexSort.Index].Value) if 0 == result {