Browse Source

fix: linked references section fails on property pages

Move assertion as it was failing for nil eids. Also add assertion
to recent-pages which used to have uuids and thus triggers the
exception in entity. Related to LOG-3180
Gabriel Horner 1 year ago
parent
commit
1cdd4bd89a

+ 6 - 6
src/main/frontend/db/utils.cljs

@@ -25,16 +25,16 @@
   ([eid]
   ([eid]
    (entity (state/get-current-repo) eid))
    (entity (state/get-current-repo) eid))
   ([repo-or-db eid]
   ([repo-or-db eid]
-   (assert (or (number? eid)
-               (sequential? eid)
-               (keyword? eid))
-           (str "Invalid entity eid: " eid))
    (when eid
    (when eid
+     (assert (or (number? eid)
+                 (sequential? eid)
+                 (keyword? eid))
+             (str "Invalid entity eid: " (pr-str eid)))
      (when-let [db (if (string? repo-or-db)
      (when-let [db (if (string? repo-or-db)
-                   ;; repo
+                     ;; repo
                      (let [repo (or repo-or-db (state/get-current-repo))]
                      (let [repo (or repo-or-db (state/get-current-repo))]
                        (conn/get-db repo))
                        (conn/get-db repo))
-                   ;; db
+                     ;; db
                      repo-or-db)]
                      repo-or-db)]
        (d/entity db eid)))))
        (d/entity db eid)))))
 
 

+ 1 - 0
src/main/frontend/handler/db_based/recent.cljs

@@ -6,6 +6,7 @@
 
 
 (defn add-page-to-recent!
 (defn add-page-to-recent!
   [db-id click-from-recent?]
   [db-id click-from-recent?]
+  (assert db-id (number? db-id))
   (when-not (:db/restoring? @state/state)
   (when-not (:db/restoring? @state/state)
     (when-let [page (db/entity db-id)]
     (when-let [page (db/entity db-id)]
       (when-not (ldb/hidden-page? page)
       (when-not (ldb/hidden-page? page)