From 00ed190ad76f357ec780d68888a04dbd5f402ea5 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Fri, 13 Oct 2023 13:21:53 +0800 Subject: [PATCH] :art: Fix database table view loading https://ld246.com/article/1697168944677 --- kernel/av/av.go | 4 ++++ kernel/model/attribute_view.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/kernel/av/av.go b/kernel/av/av.go index 9c7c708a8a8..6cfd6bdbcfb 100644 --- a/kernel/av/av.go +++ b/kernel/av/av.go @@ -520,6 +520,10 @@ func SaveAttributeView(av *AttributeView) (err error) { // 补全 block 的创建时间和更新时间 for _, v := range kv.Values { if 0 == v.Block.Created { + if "" == v.Block.ID { + v.Block.ID = ast.NewNodeID() + } + createdStr := v.Block.ID[:len("20060102150405")] created, parseErr := time.ParseInLocation("20060102150405", createdStr, time.Local) if nil == parseErr { diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index de3004e65a3..c8d21b34123 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -190,6 +190,10 @@ func RenderAttributeView(avID string) (viewable av.Viewable, attrView *av.Attrib case av.KeyTypeBlock: // 补全 block 的创建时间和更新时间 for _, v := range kv.Values { if 0 == v.Block.Created { + if "" == v.Block.ID { + v.Block.ID = ast.NewNodeID() + } + createdStr := v.Block.ID[:len("20060102150405")] created, parseErr := time.ParseInLocation("20060102150405", createdStr, time.Local) if nil == parseErr {