Explorar o código

fix: invalid graphs b/c of blocks with missing title

Gabriel Horner hai 9 meses
pai
achega
11f765638e

+ 1 - 1
deps/db/test/logseq/db/sqlite/export_test.cljs

@@ -645,7 +645,7 @@
            :file/content "// comment"}]}]
     original-data))
 
-(deftest import-graph
+(deftest ^:focus import-graph
   (let [original-data (build-original-graph-data)
         conn (db-test/create-conn-with-blocks (dissoc original-data ::sqlite-export/graph-files))
         ;; set to an unobtainable version to test this ident

+ 4 - 0
src/main/frontend/worker/db/migrate.cljs

@@ -1025,6 +1025,10 @@
                                 (and (ldb/class? entity) (nil? (:db/ident entity)))
                                 [[:db/add (:db/id entity) :db/ident (db-class/create-user-class-ident-from-name (:block/title entity))]]
 
+                                ;; fix blocks missing title
+                                (and (:block/parent entity) (nil? (:block/title entity)))
+                                [[:db/add (:db/id entity) :block/title ""]]
+
                                 (and (ldb/property? entity) (nil? (:db/ident entity)))
                                 [[:db/add (:db/id entity) :db/ident (db-property/create-user-property-ident-from-name (:block/title entity))]]