Browse Source

fix: remove current query block from query result view

Tienson Qin 1 year ago
parent
commit
202be5cc7b
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/main/frontend/components/query.cljs

+ 4 - 1
src/main/frontend/components/query.cljs

@@ -134,7 +134,10 @@
     (let [result (when *result (query-result/transform-query-result config q result'))
     (let [result (when *result (query-result/transform-query-result config q result'))
           ;; Remove hidden pages from result
           ;; Remove hidden pages from result
           result (if (and (coll? result) (not (map? result)))
           result (if (and (coll? result) (not (map? result)))
-                   (remove (fn [b] (when (and (map? b) (:block/title b)) (ldb/hidden? (:block/title b)))) result)
+                   (->> result
+                        (remove (fn [b] (when (and (map? b) (:block/title b)) (ldb/hidden? (:block/title b)))))
+                        (remove (fn [b]
+                                  (when (and current-block (:db/id current-block)) (= (:db/id b) (:db/id current-block))))))
                    result)
                    result)
           ;; Args for displaying query header and results
           ;; Args for displaying query header and results
           view-fn (if (keyword? view) (get-in (state/sub-config) [:query/views view]) view)
           view-fn (if (keyword? view) (get-in (state/sub-config) [:query/views view]) view)