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
pull/11177/head
Gabriel Horner 2024-04-18 16:07:53 -04:00
parent 0372cb6e62
commit 27aca24199
2 changed files with 16 additions and 13 deletions

View File

@ -17,7 +17,10 @@
[clojure.string :as string] [clojure.string :as string]
[logseq.db.frontend.property :as db-property])) [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?]}] [page {:keys [mode configure?]}]
(let [class? (= mode :class) (let [class? (= mode :class)
edit-input-id-prefix (str "edit-block-" (:block/uuid page)) edit-input-id-prefix (str "edit-block-" (:block/uuid page))
@ -32,23 +35,23 @@
(or has-viewable-properties? (or has-viewable-properties?
has-class-properties?))) has-class-properties?)))
[:div.ls-page-properties [:div.ls-page-properties
{:class (util/classnames [{:no-mode (nil? mode) {:class (util/classnames [{:no-properties (if class?
:no-properties (if class?
(not has-class-properties?) (not has-class-properties?)
(not has-viewable-properties?))}])} (not has-viewable-properties?))}])}
(cond (if configure?
(= mode :class) (cond
(if (and config/publishing? (not configure?)) (= mode :class)
(component-block/db-properties-cp {:editor-box editor/box}
page
(str edit-input-id-prefix "-page")
(assoc configure-opts :class-schema? false))
(component-block/db-properties-cp {:editor-box editor/box} (component-block/db-properties-cp {:editor-box editor/box}
page page
(str edit-input-id-prefix "-schema") (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} (component-block/db-properties-cp {:editor-box editor/box}
page page
(str edit-input-id-prefix "-page") (str edit-input-id-prefix "-page")

View File

@ -549,7 +549,7 @@
[:div.mb-4 [:div.mb-4
(component-block/breadcrumb config repo block-id {:level-limit 3})])) (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})) (db-page/page-properties-react page {:configure? false}))
;; blocks ;; blocks