Parcourir la source

fix: pages displayed as invalid ref in table view

Tienson Qin il y a 5 mois
Parent
commit
09b333a5c3
1 fichiers modifiés avec 4 ajouts et 7 suppressions
  1. 4 7
      src/main/frontend/components/block.cljs

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

@@ -62,7 +62,6 @@
             [frontend.mobile.util :as mobile-util]
             [frontend.modules.outliner.tree :as tree]
             [frontend.modules.shortcut.utils :as shortcut-utils]
-            [frontend.util.ref :as ref]
             [frontend.security :as security]
             [frontend.state :as state]
             [frontend.template :as template]
@@ -70,6 +69,7 @@
             [frontend.util :as util]
             [frontend.util.file-based.clock :as clock]
             [frontend.util.file-based.drawer :as drawer]
+            [frontend.util.ref :as ref]
             [frontend.util.text :as text-util]
             [goog.dom :as gdom]
             [goog.functions :refer [debounce]]
@@ -939,13 +939,13 @@
   "Component for a page. `page` argument contains :block/name which can be (un)sanitized page name.
    Keys for `config`:
    - `:preview?`: Is this component under preview mode? (If true, `page-preview-trigger` won't be registered to this `page-cp`)"
-  [state {:keys [label children preview? disable-preview? show-non-exists-page? table-view? tag? _skip-async-load?] :as config} page]
+  [state {:keys [label children preview? disable-preview? show-non-exists-page? tag? _skip-async-load?] :as config} page]
   (when-let [entity' (rum/react (:*entity state))]
     (let [entity (or (db/sub-block (:db/id entity')) entity')
           config (assoc config :block entity)]
       (cond
         entity
-        (if (ldb/page? entity)
+        (if (or (ldb/page? entity) (not (:block/page entity)))
           (let [page-name (some-> (:block/title entity) util/page-name-sanity-lc)
                 whiteboard-page? (model/whiteboard-page? entity)
                 inner (page-inner (assoc config :whiteboard-page? whiteboard-page?) entity children label)
@@ -962,10 +962,7 @@
                              (gp-mldoc/inline->edn label (mldoc/get-default-config :markdown))
                              label)))
 
-        (and (:block/name page) (util/uuid-string? (:block/name page)))
-        (invalid-node-ref (:block/name page))
-
-        (and (:block/name page) (or show-non-exists-page? table-view?))
+        (and (:block/name page) show-non-exists-page?)
         (page-inner config (merge
                             {:block/title (:block/name page)
                              :block/name (:block/name page)}