fix: can't undo/redo imported edn data

also UI doesn't refresh
This commit is contained in:
Tienson Qin
2025-10-09 11:51:02 +08:00
committed by Gabriel Horner
parent b649887b15
commit fe619d3a92
2 changed files with 8 additions and 5 deletions

View File

@@ -253,9 +253,9 @@
(defn- undo-redo-aux
[repo undo?]
(prn :undo-op (not-empty ((if undo? pop-undo-op pop-redo-op) repo)))
(if-let [op (not-empty ((if undo? pop-undo-op pop-redo-op) repo))]
(let [conn (db/get-db repo false)]
(prn :debug :undo-op op)
(cond
(= ::ui-state (ffirst op))
(do
@@ -287,6 +287,7 @@
{:undo? undo?
:editor-cursors editor-cursors
:block-content block-content}))]
(prn :debug :reversed-tx-data reversed-tx-data)
(when (seq reversed-tx-data)
(if util/node-test?
(do
@@ -333,9 +334,9 @@
[repo {:keys [tx-data tx-meta db-after db-before]}]
(let [{:keys [outliner-op]} tx-meta]
#_(prn :gen-undo
(= (:client-id tx-meta) (:client-id @state/state))
outliner-op
tx-meta)
(= (:client-id tx-meta) (:client-id @state/state))
outliner-op
tx-meta)
(when (and
(= (:client-id tx-meta) (:client-id @state/state))
outliner-op

View File

@@ -501,7 +501,9 @@
(or from-disk? new-graph?)
{:tx-report tx-report}
(or (::gp-exporter/new-graph? tx-meta) (::sqlite-export/imported-data? tx-meta))
(or (::gp-exporter/new-graph? tx-meta)
(and (::sqlite-export/imported-data? tx-meta)
(not= :batch-import-edn (:outliner-op tx-meta))))
(invoke-hooks-for-imported-graph conn tx-report)
:else