mirror of
https://github.com/penpot/penpot.git
synced 2025-05-21 17:46:11 +02:00
✨ Make workspace readiness state more robust
This commit is contained in:
parent
bd834ba840
commit
a6659601f4
2 changed files with 10 additions and 8 deletions
|
@ -104,14 +104,13 @@
|
||||||
(def workspace-drawing
|
(def workspace-drawing
|
||||||
(l/derived :workspace-drawing st/state))
|
(l/derived :workspace-drawing st/state))
|
||||||
|
|
||||||
;; FIXME: define it as function, because in some situations this
|
(defn make-workspace-ready-ref
|
||||||
;; current check is not enought for true readiness
|
[file-id]
|
||||||
(def workspace-ready?
|
|
||||||
(l/derived (fn [state]
|
(l/derived (fn [state]
|
||||||
|
(let [data (:workspace-data state)]
|
||||||
(and (:workspace-ready? state)
|
(and (:workspace-ready? state)
|
||||||
(:workspace-data state)
|
(= file-id (:current-file-id state))
|
||||||
(:current-file-id state)
|
(= file-id (:id data)))))
|
||||||
(:current-project-id state)))
|
|
||||||
st/state))
|
st/state))
|
||||||
|
|
||||||
;; TODO: rename to workspace-selected (?)
|
;; TODO: rename to workspace-selected (?)
|
||||||
|
|
|
@ -137,9 +137,12 @@
|
||||||
project (mf/deref refs/workspace-project)
|
project (mf/deref refs/workspace-project)
|
||||||
layout (mf/deref refs/workspace-layout)
|
layout (mf/deref refs/workspace-layout)
|
||||||
wglobal (mf/deref refs/workspace-global)
|
wglobal (mf/deref refs/workspace-global)
|
||||||
ready? (mf/deref refs/workspace-ready?)
|
|
||||||
read-only? (mf/deref refs/workspace-read-only?)
|
read-only? (mf/deref refs/workspace-read-only?)
|
||||||
|
|
||||||
|
ready-lens (mf/with-memo [file-id]
|
||||||
|
(refs/make-workspace-ready-ref file-id))
|
||||||
|
ready? (mf/deref ready-lens)
|
||||||
|
|
||||||
team-id (:team-id project)
|
team-id (:team-id project)
|
||||||
file-name (:name file)
|
file-name (:name file)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue