From 6cc96ef679f95323067f29b7bb4cdc58735ddf74 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 17 Mar 2025 16:25:09 +0100 Subject: [PATCH] :sparkles: Add logging for tokens update event operation --- .../app/main/ui/workspace/tokens/update.cljs | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/tokens/update.cljs b/frontend/src/app/main/ui/workspace/tokens/update.cljs index 14f1806d9d..10fe6a23a8 100644 --- a/frontend/src/app/main/ui/workspace/tokens/update.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/update.cljs @@ -1,6 +1,13 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS INC + (ns app.main.ui.workspace.tokens.update (:require [app.common.files.helpers :as cfh] + [app.common.logging :as l] [app.common.types.token :as ctt] [app.main.data.helpers :as dsh] [app.main.data.workspace.shapes :as dwsh] @@ -9,6 +16,7 @@ [app.main.ui.workspace.tokens.changes :as wtch] [app.main.ui.workspace.tokens.style-dictionary :as wtsd] [app.main.ui.workspace.tokens.token-set :as wtts] + [app.util.time :as dt] [beicon.v2.core :as rx] [clojure.data :as data] [clojure.set :as set] @@ -127,8 +135,14 @@ [state resolved-tokens] (let [file-id (get state :current-file-id) current-page-id (get state :current-page-id) - fdata (dsh/lookup-file-data state file-id)] - (->> (rx/from (:pages fdata)) + fdata (dsh/lookup-file-data state file-id) + tpoint (dt/tpoint-ms)] + + (l/inf :status "START" :hint "update-tokens") + (->> (rx/concat + (rx/of current-page-id) + (->> (rx/from (:pages fdata)) + (rx/filter (fn [id] (not= id current-page-id))))) (rx/mapcat (fn [page-id] (let [page @@ -140,6 +154,12 @@ actions (actionize-shapes-update-info page-id attrs)] + (l/inf :status "PROGRESS" + :hint "update-tokens" + :page-id (str page-id) + :elapsed (tpoint) + ::l/sync? true) + (rx/merge (rx/from actions) (->> (rx/from frame-ids) @@ -151,7 +171,11 @@ (fn [shape] (dissoc shape :position-data)) {:page-id page-id - :ignore-touched true})))))))))) + :ignore-touched true}))))))) + (rx/finalize + (fn [_] + (let [elapsed (tpoint)] + (l/inf :status "END" :hint "update-tokens" :elapsed elapsed))))))) (defn update-workspace-tokens []