fix(regression): query builder for multiple property types including :checkbox

Fixes https://github.com/logseq/db-test/issues/288. Regression caused by
572d6f4390 . Confirmed this bug was
affecting the following non-ref, non-string property types:
:checkbox, :any, :keyword and :raw-number
This commit is contained in:
Gabriel Horner
2025-05-28 14:55:15 -04:00
parent 995f8c4c38
commit 04190d22a3
2 changed files with 11 additions and 5 deletions

View File

@@ -476,7 +476,10 @@
[label value] (cond ref-type?
[(db-property/property-value-content e)
(select-keys e [:db/id :block/uuid])]
(= :datetime (:logseq.property/type property))
;; FIXME: Move query concerns out of :label as UI labels are usually strings
;; All non-string values need to be passed to the query builder since non-ref prop values use the actual value
;; This check is less fragile than listing all the property types to support e.g. :datetime, :checkbox, :keyword, :any
(not (string? v))
[v v]
:else
[(str v) v])]

View File

@@ -171,17 +171,20 @@
[*property *private-property? *find *tree opts loc values {:keys [db-graph?]}]
(let [values' (cons {:label "Select all"
:value "Select all"}
values)
(map #(hash-map :value (str (:value %))
;; Preserve original-value as non-string values like boolean do not display in select
:original-value (:value %))
values))
find' (rum/react *find)]
(select values'
(fn [{:keys [value]}]
(fn [{:keys [value original-value]}]
(let [k (cond
db-graph? (if @*private-property? :private-property :property)
(= find' :page) :page-property
:else :property)
x (if (= value "Select all")
[k @*property]
[k @*property value])]
[k @*property original-value])]
(reset! *property nil)
(append-tree! *tree opts loc x))))))
@@ -193,7 +196,7 @@
(fn [_property]
(p/let [result (if db-graph?
(p/let [result (db-async/<get-property-values @*property)]
(map (fn [{:keys [label _value]}]
(map (fn [{:keys [label]}]
{:label label
:value label})
result))