From 27aca24199f4f154ceeb568311fa262988b65e29 Mon Sep 17 00:00:00 2001 From: Gabriel Horner Date: Thu, 18 Apr 2024 16:07:53 -0400 Subject: [PATCH] fix: pages not displaying their page properties on initial load. Page properties would only show up after clicking on Configure which is confusing and made the initial page load seem buggy --- .../frontend/components/db_based/page.cljs | 27 ++++++++++--------- src/main/frontend/components/page.cljs | 2 +- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/frontend/components/db_based/page.cljs b/src/main/frontend/components/db_based/page.cljs index ef857e112..a53e60a4c 100644 --- a/src/main/frontend/components/db_based/page.cljs +++ b/src/main/frontend/components/db_based/page.cljs @@ -17,7 +17,10 @@ [clojure.string :as string] [logseq.db.frontend.property :as db-property])) -(rum/defc page-properties < rum/reactive +(rum/defc page-properties + "This component is called by page-inner and within configure/info modal. This should not + be displaying properties from both components at the same time" + < rum/reactive [page {:keys [mode configure?]}] (let [class? (= mode :class) edit-input-id-prefix (str "edit-block-" (:block/uuid page)) @@ -32,23 +35,23 @@ (or has-viewable-properties? has-class-properties?))) [:div.ls-page-properties - {:class (util/classnames [{:no-mode (nil? mode) - :no-properties (if class? + {:class (util/classnames [{:no-properties (if class? (not has-class-properties?) (not has-viewable-properties?))}])} - (cond - (= mode :class) - (if (and config/publishing? (not configure?)) - (component-block/db-properties-cp {:editor-box editor/box} - page - (str edit-input-id-prefix "-page") - (assoc configure-opts :class-schema? false)) + (if configure? + (cond + (= mode :class) (component-block/db-properties-cp {:editor-box editor/box} page (str edit-input-id-prefix "-schema") - (assoc configure-opts :class-schema? true))) + (assoc configure-opts :class-schema? true)) - (= mode :page) + (= mode :page) + (component-block/db-properties-cp {:editor-box editor/box} + page + (str edit-input-id-prefix "-page") + (assoc configure-opts :class-schema? false :page? true))) + ;; default view for page-inner (component-block/db-properties-cp {:editor-box editor/box} page (str edit-input-id-prefix "-page") diff --git a/src/main/frontend/components/page.cljs b/src/main/frontend/components/page.cljs index bbc42687e..ea0bfd5cd 100644 --- a/src/main/frontend/components/page.cljs +++ b/src/main/frontend/components/page.cljs @@ -549,7 +549,7 @@ [:div.mb-4 (component-block/breadcrumb config repo block-id {:level-limit 3})])) - (when (and db-based? (not block?) (not preview?)) + (when (and db-based? (not block?) (not preview?) (not (::show-page-info? state))) (db-page/page-properties-react page {:configure? false})) ;; blocks