fix: don't write to files when db transaction failed

This commit is contained in:
Tienson Qin
2021-03-08 12:59:00 +08:00
parent 5f674ce095
commit 86250f1bae
3 changed files with 56 additions and 56 deletions

View File

@@ -2017,16 +2017,14 @@
file-content (db/get-file file-path)
new-content (utf8/insert! file-content start-pos old-end-pos (apply str (map :block/content blocks)))
blocks (map (fn [b] (dissoc b :block/children)) blocks)]
(profile
"Indent/outdent: "
(repo-handler/transact-react-and-alter-file!
repo
(concat
blocks
after-blocks)
{:key :block/change
:data (map (fn [block] (assoc block :block/page page)) blocks)}
[[file-path new-content]])))
(repo-handler/transact-react-and-alter-file!
repo
(concat
blocks
after-blocks)
{:key :block/change
:data (map (fn [block] (assoc block :block/page page)) blocks)}
[[file-path new-content]]))
(gdom/getElement "date-time-picker")
nil