diff --git a/frontend/src/app/main/repo.cljs b/frontend/src/app/main/repo.cljs index 275b1ea106..cc2c8828fd 100644 --- a/frontend/src/app/main/repo.cljs +++ b/frontend/src/app/main/repo.cljs @@ -53,13 +53,13 @@ ([id params {:keys [raw-transit?]}] (let [decode-transit (if raw-transit? - identity - (partial rx/map http/conditional-decode-transit))] + http/conditional-error-decode-transit + http/conditional-decode-transit)] (->> (http/send! {:method :get :uri (u/join base-uri "api/rpc/query/" (name id)) :credentials "include" :query params}) - (decode-transit) + (rx/map decode-transit) (rx/mapcat handle-response))))) (defn- send-mutation! diff --git a/frontend/src/app/main/ui/shapes/text/fontfaces.cljs b/frontend/src/app/main/ui/shapes/text/fontfaces.cljs index a470d52388..cb692b663e 100644 --- a/frontend/src/app/main/ui/shapes/text/fontfaces.cljs +++ b/frontend/src/app/main/ui/shapes/text/fontfaces.cljs @@ -68,7 +68,7 @@ ;; Calculate the data-uris for these fonts fonts-embed (embed/use-data-uris fonts-urls) - loading? (d/seek #(not (contains? fonts-embed %)) fonts-urls) + loading? (some? (d/seek #(not (contains? fonts-embed %)) fonts-urls)) ;; Creates a style tag by replacing the urls with the data uri style (replace-embeds fonts-css fonts-urls fonts-embed)] diff --git a/frontend/src/app/util/http.cljs b/frontend/src/app/util/http.cljs index 5c890ac890..37c8cac350 100644 --- a/frontend/src/app/util/http.cljs +++ b/frontend/src/app/util/http.cljs @@ -143,6 +143,12 @@ (assoc response :body (t/decode-str body)) response))) +(defn conditional-error-decode-transit + [{:keys [body status] :as response}] + (if (and (>= status 400) (string? body)) + (assoc response :body (t/decode-str body)) + response)) + (defn success? [{:keys [status]}] (<= 200 status 299))