From 526f6ef841e19fa3c8790a1bedd26ed9c2e64756 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 20 Mar 2024 16:12:00 +0100 Subject: [PATCH] :bug: Fix release build issue Caused by an unsolved corner case of the interaction of code-move between modules and types defined with reify. Mainly moves some definition of protocol to one module and the definition of the type to other, and as the definition of the type is conditional to the function execution, the whole build fails to initialize because the second protocol extension implementation can't find the type initialized on application startup. --- frontend/src/app/main/render.cljs | 16 ---------------- frontend/src/app/main/ui/dashboard/grid.cljs | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/frontend/src/app/main/render.cljs b/frontend/src/app/main/render.cljs index 45d6868a7..16c961b5d 100644 --- a/frontend/src/app/main/render.cljs +++ b/frontend/src/app/main/render.cljs @@ -28,9 +28,7 @@ [app.common.types.shape-tree :as ctst] [app.common.types.shape.layout :as ctl] [app.config :as cfg] - [app.main.features :as features] [app.main.fonts :as fonts] - [app.main.store :as st] [app.main.ui.context :as muc] [app.main.ui.shapes.bool :as bool] [app.main.ui.shapes.circle :as circle] @@ -46,7 +44,6 @@ [app.main.ui.shapes.svg-raw :as svg-raw] [app.main.ui.shapes.text :as text] [app.main.ui.shapes.text.fontfaces :as ff] - [app.main.worker :as wrk] [app.util.dom :as dom] [app.util.http :as http] [app.util.strings :as ust] @@ -671,16 +668,3 @@ (do (l/warn :msg "imposter shape is nil") (rx/empty))))) - -(defn render-thumbnail - [file-id revn] - (->> (wrk/ask! {:cmd :thumbnails/generate-for-file - :revn revn - :file-id file-id - :features (features/get-team-enabled-features @st/state)}) - (rx/mapcat (fn [{:keys [fonts] :as result}] - (->> (fonts/render-font-styles fonts) - (rx/map (fn [styles] - (assoc result - :styles styles - :width 252)))))))) diff --git a/frontend/src/app/main/ui/dashboard/grid.cljs b/frontend/src/app/main/ui/dashboard/grid.cljs index 765d91fc1..dfffc9c66 100644 --- a/frontend/src/app/main/ui/dashboard/grid.cljs +++ b/frontend/src/app/main/ui/dashboard/grid.cljs @@ -13,6 +13,7 @@ [app.common.logging :as log] [app.main.data.dashboard :as dd] [app.main.data.messages :as msg] + [app.main.features :as features] [app.main.fonts :as fonts] [app.main.rasterizer :as thr] [app.main.refs :as refs] @@ -26,6 +27,7 @@ [app.main.ui.dashboard.placeholder :refer [empty-placeholder loading-placeholder]] [app.main.ui.hooks :as h] [app.main.ui.icons :as i] + [app.main.worker :as wrk] [app.util.color :as uc] [app.util.dom :as dom] [app.util.dom.dnd :as dnd] @@ -47,10 +49,23 @@ (->> (rp/cmd! :create-file-thumbnail params) (rx/map :uri)))) +(defn render-thumbnail + [file-id revn] + (->> (wrk/ask! {:cmd :thumbnails/generate-for-file + :revn revn + :file-id file-id + :features (features/get-team-enabled-features @st/state)}) + (rx/mapcat (fn [{:keys [fonts] :as result}] + (->> (fonts/render-font-styles fonts) + (rx/map (fn [styles] + (assoc result + :styles styles + :width 252)))))))) + (defn- ask-for-thumbnail "Creates some hooks to handle the files thumbnails cache" [file-id revn] - (->> (render/render-thumbnail file-id revn) + (->> (render-thumbnail file-id revn) (rx/mapcat thr/render) (rx/mapcat (partial persist-thumbnail file-id revn))))