mirror of
https://github.com/logseq/logseq.git
synced 2026-05-28 06:34:34 +00:00
fix: select options
This commit is contained in:
@@ -828,7 +828,13 @@
|
||||
(:db/ident block)
|
||||
(:db/ident property))
|
||||
result (db-async/<get-block-property-values (state/get-current-repo)
|
||||
property-ident)]
|
||||
property-ident)
|
||||
non-loaded-ids (filter (fn [id] (not (db/entity id))) result)
|
||||
repo (state/get-current-repo)
|
||||
_ (p/all (map (fn [id] (db-async/<get-block repo id
|
||||
{:children? false
|
||||
:including-property-vals? false
|
||||
:skip-refresh? true})) non-loaded-ids))]
|
||||
(reset! *values result))))]
|
||||
(refresh-result-f)
|
||||
(assoc state
|
||||
|
||||
@@ -104,13 +104,14 @@
|
||||
[(not= ?v ?empty-id)]]
|
||||
property-id
|
||||
empty-id)]
|
||||
(if default-value-id
|
||||
(distinct
|
||||
(if default-value-id
|
||||
;; put default value the first
|
||||
(concat [default-value-id] result)
|
||||
result))))
|
||||
(cons default-value-id result)
|
||||
result)))))
|
||||
|
||||
(defn <get-block
|
||||
[graph name-or-uuid & {:keys [children? skip-transact? cache?]
|
||||
[graph name-or-uuid & {:keys [children? skip-transact? skip-refresh? cache?]
|
||||
:or {children? true
|
||||
cache? true}
|
||||
:as opts}]
|
||||
@@ -143,7 +144,8 @@
|
||||
block-and-children (cons block children)
|
||||
affected-keys [[:frontend.worker.react/block (:db/id block)]]]
|
||||
(d/transact! conn (remove (fn [b] (:block.temp/fully-loaded? (db/entity (:db/id b)))) block-and-children))
|
||||
(react/refresh-affected-queries! graph affected-keys)))
|
||||
(when-not skip-refresh?
|
||||
(react/refresh-affected-queries! graph affected-keys))))
|
||||
|
||||
(when cache?
|
||||
(state/update-state! :db/async-query-loading (fn [s] (disj s name'))))
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
(ns frontend.db.async.util
|
||||
"Async util helper"
|
||||
(:require [frontend.state :as state]
|
||||
[promesa.core :as p]
|
||||
(:require [datascript.core :as d]
|
||||
[frontend.db.conn :as db-conn]
|
||||
[datascript.core :as d]
|
||||
[logseq.db :as ldb]))
|
||||
[frontend.state :as state]
|
||||
[logseq.db :as ldb]
|
||||
[promesa.core :as p]))
|
||||
|
||||
(defn <q
|
||||
[graph {:keys [transact-db?]
|
||||
@@ -14,7 +14,7 @@
|
||||
(when-let [^Object sqlite @state/*db-worker]
|
||||
(let [*async-queries (:db/async-queries @state/state)
|
||||
async-requested? (get @*async-queries [inputs opts])]
|
||||
(if async-requested?
|
||||
(if (and async-requested? transact-db?)
|
||||
(let [db (db-conn/get-db graph)]
|
||||
(apply d/q (first inputs) db (rest inputs)))
|
||||
(p/let [result (.q sqlite graph (ldb/write-transit-str inputs))]
|
||||
|
||||
Reference in New Issue
Block a user