🐛 Fix actions when workspace is visited first time (#6129)

* 🐛 Fix actions when workspace is visited first time

* 📎 Fix linter errors

* 🐛 Fix problem with integration test

* 📎 Fix linter errors

* 📎 Fix linter errors

---------

Co-authored-by: alonso.torres <alonso.torres@kaleidos.net>
This commit is contained in:
Marina López 2025-03-24 18:02:05 +01:00 committed by GitHub
parent 7bc000517f
commit a6133e9c48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 34 additions and 16 deletions

View file

@ -204,6 +204,9 @@
(rx/filter #(= % ::force-persist))))]
(rx/merge
(->> notifier-s
(rx/map #(ptk/data-event ::persistence-notification)))
(->> local-commits-s
(rx/debounce 200)
(rx/map (fn [_]

View file

@ -44,6 +44,7 @@
[app.main.data.helpers :as dsh]
[app.main.data.modal :as modal]
[app.main.data.notifications :as ntf]
[app.main.data.persistence :as-alias dps]
[app.main.data.plugins :as dp]
[app.main.data.profile :as du]
[app.main.data.project :as dpj]
@ -354,6 +355,11 @@
(-> (workspace-initialized file-id)
(with-meta {:file-id file-id}))))))
(->> stream
(rx/filter (ptk/type? ::dps/persistence-notification))
(rx/take 1)
(rx/map dwc/set-workspace-visited))
(when-let [component-id (some-> rparams :component-id parse-uuid)]
(->> stream
(rx/filter (ptk/type? ::workspace-initialized))
@ -476,10 +482,13 @@
ptk/WatchEvent
(watch [_ state _]
(if-let [page (dsh/lookup-page state file-id page-id)]
(rx/of (initialize-page* file-id page-id page)
(dwth/watch-state-changes file-id page-id)
(dwl/watch-component-changes)
(select-frame-tool file-id page-id))
(rx/concat (rx/of (initialize-page* file-id page-id page)
(dwth/watch-state-changes file-id page-id)
(dwl/watch-component-changes))
(let [profile (:profile state)
props (get profile :props)]
(when (not (:workspace-visited props))
(rx/of (select-frame-tool file-id page-id)))))
(rx/of (dcm/go-to-workspace :file-id file-id ::rt/replace true))))))
(defn finalize-page

View file

@ -7,7 +7,6 @@
(ns app.main.data.workspace.common
(:require
[app.common.logging :as log]
[app.config :as cf]
[app.main.data.profile :as du]
[app.main.data.workspace.layout :as dwl]
[beicon.v2.core :as rx]
@ -38,7 +37,7 @@
(watch [_ state _]
(let [profile (:profile state)
props (get profile :props)]
(when (and (cf/external-feature-flag "boards-03" "test") (not (:workspace-visited props)))
(when (not (:workspace-visited props))
(rx/of (du/update-profile-props {:workspace-visited true})))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

@ -14,7 +14,6 @@
[app.main.data.changes :as dch]
[app.main.data.helpers :as dsh]
[app.main.data.persistence :as-alias dps]
[app.main.data.workspace.common :as dwc]
[app.main.data.workspace.notifications :as-alias wnt]
[app.main.rasterizer :as thr]
[app.main.refs :as refs]
@ -293,10 +292,4 @@
(rx/mapcat #(into #{} %))
(rx/map #(update-thumbnail file-id page-id % "frame" "watch-state-changes"))))
;; WARNING: This is a workaround for an AB test, in case we consolidate this change we should
;; find a better way to handle this.
(->> notifier-s
(rx/take 1)
(rx/map dwc/set-workspace-visited))
(rx/take-until stopper-s))))))

View file

@ -10,7 +10,6 @@
[app.common.data.macros :as dm]
[app.common.geom.point :as gpt]
[app.common.media :as cm]
[app.config :as cf]
[app.main.data.event :as ev]
[app.main.data.modal :as modal]
[app.main.data.workspace :as dw]
@ -126,8 +125,7 @@
profile (mf/deref refs/profile)
props (get profile :props)
test-tooltip-board-text
(if (and (cf/external-feature-flag "boards-03" "test")
(not (:workspace-visited props)))
(if (not (:workspace-visited props))
(tr "workspace.toolbar.frame-first-time" (sc/get-tooltip :draw-frame))
(tr "workspace.toolbar.frame" (sc/get-tooltip :draw-frame)))]