diff --git a/backend/src/app/binfile/v3.clj b/backend/src/app/binfile/v3.clj index 952cb69e8f..311cbc96aa 100644 --- a/backend/src/app/binfile/v3.clj +++ b/backend/src/app/binfile/v3.clj @@ -316,7 +316,6 @@ (doseq [[shape-id shape] objects] (let [path (str "files/" file-id "/pages/" page-id "/" shape-id ".json") - shape (assoc shape :page-id page-id) shape (encode-shape shape)] (write-entry! output path shape))))) diff --git a/backend/src/app/rpc/commands/files_thumbnails.clj b/backend/src/app/rpc/commands/files_thumbnails.clj index 024bce17e7..8aaa98cbdd 100644 --- a/backend/src/app/rpc/commands/files_thumbnails.clj +++ b/backend/src/app/rpc/commands/files_thumbnails.clj @@ -98,14 +98,13 @@ (defn get-file-data-for-thumbnail [{:keys [::db/conn] :as cfg} {:keys [data id] :as file} strip-frames-with-thumbnails] (letfn [;; function responsible on finding the frame marked to be - ;; used as thumbnail; the returned frame always have - ;; the :page-id set to the page that it belongs. + ;; used as thumbnail; returns a [frame page-id] pair. (get-thumbnail-frame [{:keys [data]}] - (d/seek #(or (:use-for-thumbnail %) - (:use-for-thumbnail? %)) ; NOTE: backward comp (remove on v1.21) + (d/seek (fn [[frame]] (or (:use-for-thumbnail frame) + (:use-for-thumbnail? frame))) ; NOTE: backward comp (remove on v1.21) (for [page (-> data :pages-index vals) frame (-> page :objects ctt/get-frames)] - (assoc frame :page-id (:id page))))) + [frame (:id page)]))) ;; function responsible to filter objects data structure of ;; all unneeded shapes if a concrete frame is provided. If no @@ -152,9 +151,9 @@ objects)))] - (let [frame (get-thumbnail-frame file) + (let [[frame page-id] (get-thumbnail-frame file) frame-id (:id frame) - page-id (or (:page-id frame) + page-id (or page-id (-> data :pages first)) page (dm/get-in data [:pages-index page-id]) diff --git a/library/src/lib/export.cljs b/library/src/lib/export.cljs index 7ce561fa12..024e4e0d92 100644 --- a/library/src/lib/export.cljs +++ b/library/src/lib/export.cljs @@ -118,9 +118,8 @@ [(str "files/" id "/pages/" page-id ".json") (delay (-> page encode-page json/encode))] (map (fn [[shape-id shape]] - (let [shape (assoc shape :page-id page-id)] - [(str "files/" id "/pages/" page-id "/" shape-id ".json") - (delay (encode-shape* shape))])) + [(str "files/" id "/pages/" page-id "/" shape-id ".json") + (delay (encode-shape* shape))]) objects))))))) (->> (get data :components)