Przeglądaj źródła

disable nlp-date? property in db graphs

We have date properties in db graphs and users should be using them
instead of this poor performing approach
Gabriel Horner 2 lat temu
rodzic
commit
8df7c37245

+ 0 - 1
deps/db/src/logseq/db/property.cljs

@@ -31,7 +31,6 @@
    ;; query-sort-by is either a property uuid or a keyword where keyword is a special frontend keyword
    :query-sort-by {:schema {:type :any}}
    :query-sort-desc {:schema {:type :checkbox}}
-   :logseq.query/nlp-date {:schema {:type :checkbox}}
    :ls-type {:schema {:type :keyword}}
    :hl-type {:schema {:type :keyword}}
    :hl-page {:schema {:type :number}}

+ 4 - 3
src/main/frontend/components/query_table.cljs

@@ -67,14 +67,14 @@
   "Return current sort direction and column being sorted, respectively
   :sort-desc? and :sort-by-column. :sort-by-column is nil if no sorting is to be
   done"
-  [current-block]
+  [current-block {:keys [db-graph?]}]
   (let [properties (:block/properties current-block)
         p-desc? (pu/lookup properties :query-sort-desc)
         desc? (if (some? p-desc?) p-desc? true)
         properties (:block/properties current-block)
         query-sort-by (pu/lookup properties :query-sort-by)
         ;; Starting with #6105, we started putting properties under namespaces.
-        nlp-date? (pu/lookup properties :logseq.query/nlp-date)
+        nlp-date? (and (not db-graph?) (pu/lookup properties :logseq.query/nlp-date))
         sort-by-column (or (if (uuid? query-sort-by) query-sort-by (keyword query-sort-by))
                            (if (query-dsl/query-contains-filter? (:block/content current-block) "sort-by")
                              nil
@@ -289,9 +289,10 @@
   (when current-block
     (let [result' (if page? result (attach-clock-property result))
           columns (get-columns current-block result' {:page? page?})
+          db-graph? (config/db-based-graph? (state/get-current-repo))
           ;; Sort state needs to be in sync between final result and sortable title
           ;; as user needs to know if there result is sorted
-          sort-state (get-sort-state current-block)
+          sort-state (get-sort-state current-block {:db-graph? db-graph?})
           sort-result (sort-result result (assoc sort-state :page? page?))
           table-version (get-shui-component-version :table config)]
       (case table-version