Skip to content

Commit

Permalink
🐛 Database render deleted block https://ld246.com/article/16957909060…
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Oct 3, 2023
1 parent f6a8ca2 commit c5a25fe
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions kernel/model/attribute_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,19 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a

// 过滤掉不存在的行
var notFound []string
for blockID, v := range rows {
if v[0].IsDetached {
for blockID, values := range rows {
blockValue := getBlockValue(values)
if nil == blockValue {
notFound = append(notFound, blockID)
continue
}

if blockValue.IsDetached {
continue
}

if nil != blockValue.Block && "" == blockValue.Block.ID {
notFound = append(notFound, blockID)
continue
}

Expand Down Expand Up @@ -291,6 +302,16 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a
return
}

func getBlockValue(values []*av.Value) (ret *av.Value) {
for _, v := range values {
if av.KeyTypeBlock == v.Type {
ret = v
break
}
}
return
}

func (tx *Transaction) doSetAttrViewName(operation *Operation) (ret *TxErr) {
err := setAttributeViewName(operation)
if nil != err {
Expand Down

0 comments on commit c5a25fe

Please sign in to comment.