mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 23:18:48 -05: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
|
||||
(l/derived :workspace-drawing st/state))
|
||||
|
||||
;; FIXME: define it as function, because in some situations this
|
||||
;; current check is not enought for true readiness
|
||||
(def workspace-ready?
|
||||
(defn make-workspace-ready-ref
|
||||
[file-id]
|
||||
(l/derived (fn [state]
|
||||
(and (:workspace-ready? state)
|
||||
(:workspace-data state)
|
||||
(:current-file-id state)
|
||||
(:current-project-id state)))
|
||||
(let [data (:workspace-data state)]
|
||||
(and (:workspace-ready? state)
|
||||
(= file-id (:current-file-id state))
|
||||
(= file-id (:id data)))))
|
||||
st/state))
|
||||
|
||||
;; TODO: rename to workspace-selected (?)
|
||||
|
|
|
@ -137,9 +137,12 @@
|
|||
project (mf/deref refs/workspace-project)
|
||||
layout (mf/deref refs/workspace-layout)
|
||||
wglobal (mf/deref refs/workspace-global)
|
||||
ready? (mf/deref refs/workspace-ready?)
|
||||
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)
|
||||
file-name (:name file)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue