Browse Source

fix: collapsed? not working on advanced queries

Tienson Qin 3 years ago
parent
commit
b4cabb2a85
1 changed files with 9 additions and 7 deletions
  1. 9 7
      src/main/frontend/components/block.cljs

+ 9 - 7
src/main/frontend/components/block.cljs

@@ -3259,7 +3259,7 @@
               [:div.flex.flex-1.flex-row
                (ui/icon "search" {:size 14})
                [:div.ml-1 (str "Live query" (when dsl-page-query? " for pages"))]]
-              (when-not collapsed?'
+              (when (or (not dsl-query?) (not collapsed?'))
                 [:div.flex.flex-row.items-center.fade-in
                  (when (> (count result) 0)
                    [:span.results-count
@@ -3292,12 +3292,14 @@
                                                       :on-mouse-down (fn [e]
                                                                        (util/stop e)
                                                                        (trigger-custom-query! state *query-error))}))]])])
-           (if built-in?
-             (ui/foldable
-              (query-title config title)
-              (fn []
-                (custom-query-inner config q opts))
-              {})
+           (if (or built-in? (not dsl-query?))
+             [:div {:style {:margin-left 2}}
+              (ui/foldable
+               (query-title config title)
+               (fn []
+                 (custom-query-inner config q opts))
+               {:default-collapsed? collapsed?
+                :title-trigger? true})]
              [:div.bd
               (query-title config title)
               (when-not collapsed?'