File tree Expand file tree Collapse file tree 2 files changed +13
-21
lines changed Expand file tree Collapse file tree 2 files changed +13
-21
lines changed Original file line number Diff line number Diff line change 6
6
[logseq.common.util :as common-util]
7
7
[promesa.core :as p])))
8
8
9
- #?(:cljs
10
- (defn throw-err
11
- [v]
12
- (if (instance? ExceptionInfo v) (throw v) v)))
9
+ (comment
10
+ #?(:cljs
11
+ (defn throw-err
12
+ [v]
13
+ (if (instance? ExceptionInfo v) (throw v) v)))
13
14
14
- (defmacro <?
15
- [port]
16
- `(throw-err (cljs.core.async/<! ~port)))
15
+ (defmacro <?
16
+ [port]
17
+ `(throw-err (cljs.core.async/<! ~port) )))
17
18
18
19
#?(:cljs
19
20
(defn c->p
Original file line number Diff line number Diff line change 1
1
(ns frontend.db.transact
2
2
" Provides async transact for use with ldb/transact!"
3
- (:require [clojure.core.async :as async]
4
- [clojure.core.async.interop :refer [p->c]]
5
- [frontend.common.async-util :include-macros true :refer [<?]]
6
- [frontend.state :as state]
3
+ (:require [frontend.state :as state]
7
4
[frontend.util :as util]
8
- [lambdaisland.glogi :as log]
9
5
[logseq.outliner.op :as outliner-op]
10
6
[promesa.core :as p]))
11
7
12
8
(defn worker-call
13
9
[request-f]
14
- (let [response (p/deferred )]
15
- (async/go
16
- (let [result (<? (p->c (request-f )))]
17
- (if (:ex-data result)
18
- (do
19
- (log/error :worker-request-failed result)
20
- (p/reject! response result))
21
- (p/resolve! response result))))
22
- response))
10
+ (p/let [result (request-f )]
11
+ ; ; yields to ensure ui db to be updated before resolved
12
+ (p/delay 0 )
13
+ result))
23
14
24
15
(defn transact [worker-transact repo tx-data tx-meta]
25
16
(let [tx-meta' (assoc tx-meta
You can’t perform that action at this time.
0 commit comments