Skip to content

Commit 7dc155b

Browse files
committed
fix: file graph import
1 parent 68c5ab1 commit 7dc155b

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

deps/graph-parser/src/logseq/graph_parser/exporter.cljs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,7 +1791,7 @@
17911791
(split-pages-and-properties-tx pages-tx old-properties existing-pages (:import-state options) @(:upstream-properties tx-options))
17921792
;; _ (when (seq property-pages-tx) (cljs.pprint/pprint {:property-pages-tx property-pages-tx}))
17931793
;; Necessary to transact new property entities first so that block+page properties can be transacted next
1794-
main-props-tx-report (ldb/transact! conn property-pages-tx {::new-graph? true ::path file})
1794+
main-props-tx-report (d/transact! conn property-pages-tx {::new-graph? true ::path file})
17951795
_ (save-from-tx property-pages-tx options)
17961796

17971797
classes-tx @(:classes-tx tx-options)
@@ -1817,13 +1817,13 @@
18171817
;; [:whiteboard-pages :pages-index :page-properties-tx :property-page-properties-tx :pages-tx' :classes-tx :blocks-index :blocks-tx]
18181818
;; [whiteboard-pages pages-index page-properties-tx property-page-properties-tx pages-tx' classes-tx blocks-index blocks-tx]))
18191819
;; _ (when (not (seq whiteboard-pages)) (cljs.pprint/pprint {#_:property-pages-tx #_property-pages-tx :pages-tx pages-tx :tx tx'}))
1820-
main-tx-report (ldb/transact! conn tx' {::new-graph? true ::path file})
1820+
main-tx-report (d/transact! conn tx' {::new-graph? true ::path file})
18211821
_ (save-from-tx tx' options)
18221822

18231823
upstream-properties-tx
18241824
(build-upstream-properties-tx @conn @(:upstream-properties tx-options) (:import-state options) log-fn)
18251825
;; _ (when (seq upstream-properties-tx) (cljs.pprint/pprint {:upstream-properties-tx upstream-properties-tx}))
1826-
upstream-tx-report (when (seq upstream-properties-tx) (ldb/transact! conn upstream-properties-tx {::new-graph? true ::path file}))
1826+
upstream-tx-report (when (seq upstream-properties-tx) (d/transact! conn upstream-properties-tx {::new-graph? true ::path file}))
18271827
_ (save-from-tx upstream-properties-tx options)]
18281828

18291829
;; Return all tx-reports that occurred in this fn as UI needs to know what changed

deps/outliner/src/logseq/outliner/db_pipeline.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"Modified copy of frontend.worker.pipeline/invoke-hooks that handles new DB graphs but
1313
doesn't handle updating DB graphs well yet e.g. doesn't handle :block/tx-id"
1414
[conn tx-report]
15-
(when-not (:pipeline-replace? (:tx-meta tx-report))
15+
(when-not (:transact-new-graph-refs? (:tx-meta tx-report))
1616
;; TODO: Handle block edits with separate :block/refs rebuild as deleting property values is buggy
1717
(outliner-pipeline/transact-new-db-graph-refs conn tx-report)))
1818

deps/outliner/src/logseq/outliner/pipeline.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,5 +147,5 @@
147147
(let [{:keys [blocks]} (ds-report/get-blocks-and-pages tx-report)
148148
refs-tx-report (when-let [refs-tx (and (seq blocks) (rebuild-block-refs-tx tx-report blocks))]
149149
(ldb/transact! conn refs-tx (-> (:tx-meta tx-report)
150-
(assoc :pipeline-replace? true))))]
150+
(assoc :transact-new-graph-refs? true))))]
151151
refs-tx-report))

src/main/frontend/worker/pipeline.cljs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -431,14 +431,15 @@
431431

432432
(defn invoke-hooks
433433
[repo conn {:keys [tx-meta] :as tx-report} context]
434-
(let [{:keys [from-disk? new-graph?]} tx-meta]
435-
(cond
436-
(or from-disk? new-graph?)
437-
{:tx-report tx-report}
434+
(let [{:keys [from-disk? new-graph? transact-new-graph-refs?]} tx-meta]
435+
(when-not transact-new-graph-refs?
436+
(cond
437+
(or from-disk? new-graph?)
438+
{:tx-report tx-report}
438439

439-
(or (::gp-exporter/new-graph? tx-meta)
440-
(and (::sqlite-export/imported-data? tx-meta) (:import-db? tx-meta)))
441-
(invoke-hooks-for-imported-graph conn tx-report)
440+
(or (::gp-exporter/new-graph? tx-meta)
441+
(and (::sqlite-export/imported-data? tx-meta) (:import-db? tx-meta)))
442+
(invoke-hooks-for-imported-graph conn tx-report)
442443

443-
:else
444-
(invoke-hooks-default repo conn tx-report context))))
444+
:else
445+
(invoke-hooks-default repo conn tx-report context)))))

0 commit comments

Comments
 (0)