mirror of
https://github.com/logseq/logseq.git
synced 2026-05-27 06:04:23 +00:00
fix: stable sort order
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
[goog.dom :as gdom]
|
||||
[goog.functions :refer [debounce]]
|
||||
[lambdaisland.glogi :as log]
|
||||
[logseq.common.util :as common-util]
|
||||
[logseq.common.util.macro :as macro-util]
|
||||
[logseq.db :as ldb]
|
||||
[logseq.db.frontend.content :as db-content]
|
||||
@@ -619,15 +618,12 @@
|
||||
[property selected-choices items]
|
||||
(if (:property/closed-values property)
|
||||
items ; sorted by order
|
||||
(sort
|
||||
(common-util/by-sorting
|
||||
[{:get-value db-property/property-value-content
|
||||
:asc? true}
|
||||
{:get-value (fn [item] (selected-choices (:db/id item)))
|
||||
:asc? false}])
|
||||
(sort-by
|
||||
(juxt (fn [item] (not (selected-choices (:db/id item))))
|
||||
db-property/property-value-content)
|
||||
items)))
|
||||
|
||||
(defn- select-aux
|
||||
(rum/defc select-aux
|
||||
[block property {:keys [items selected-choices multiple-choices?] :as opts}]
|
||||
(let [selected-choices (->> selected-choices
|
||||
(remove nil?)
|
||||
@@ -637,7 +633,7 @@
|
||||
clear-value-label [:div.flex.flex-row.items-center.gap-1.text-sm
|
||||
(ui/icon "x" {:size 14})
|
||||
[:div clear-value]]
|
||||
items (sort-select-items property selected-choices items)
|
||||
[items _] (hooks/use-state (sort-select-items property selected-choices items))
|
||||
items' (->>
|
||||
(if (and (seq selected-choices)
|
||||
(not multiple-choices?)
|
||||
|
||||
Reference in New Issue
Block a user