fix: paste of nonexist block not handled

close #1720
pull/1735/head
Tienson Qin 2021-05-04 21:43:09 +08:00
parent 0724cbe4b9
commit aa029dfe0d
2 changed files with 6 additions and 0 deletions

View File

@ -1,5 +1,6 @@
(ns frontend.db.outliner
(:require [datascript.core :as d]
[frontend.db :as db]
[frontend.db.react :as react]
[frontend.util :as util]
[frontend.debug :as debug]
@ -54,3 +55,7 @@
[?a :block/journal? true]]
@conn)]
(flatten r)))
(defn remove-non-existed-refs!
[refs]
(filter db/entity refs))

View File

@ -130,6 +130,7 @@
(let [m (-> (:data this)
(dissoc :block/children :block/dummy? :block/meta)
(util/remove-nils))
m (update m :block/refs db-outliner/remove-non-existed-refs!)
other-tx (:db/other-tx m)]
(when (seq other-tx)
(swap! txs-state (fn [txs]