0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-11 23:31:21 -05:00

🐛 Fix race condition on lentes (update deps).

This commit is contained in:
Andrey Antukh 2020-01-07 16:29:55 +01:00
parent dc9fc5e5a9
commit ebc76849b7
5 changed files with 21 additions and 34 deletions

View file

@ -13,7 +13,7 @@
funcool/beicon {:mvn/version "6.0.0-SNAPSHOT"}
funcool/cuerdas {:mvn/version "2.2.0"}
funcool/lentes {:mvn/version "1.3.3"}
funcool/lentes {:mvn/version "1.4.0-SNAPSHOT"}
funcool/potok {:mvn/version "2.8.0-SNAPSHOT"}
funcool/promesa {:mvn/version "4.0.2"}
funcool/rumext {:mvn/version "2.0.0-SNAPSHOT"}

View file

@ -282,6 +282,17 @@
(assoc :workspace-layout default-layout)
(assoc :workspace-local local))))))
(defn finalize
[file-id page-id]
(s/assert ::us/uuid file-id)
(s/assert ::us/uuid page-id)
(ptk/reify ::initialized
ptk/UpdateEvent
(update [_ state]
(dissoc state
:workspace-page
:workspace-data))))
(defn initialize-page
[page-id]
(ptk/reify ::initialize-page
@ -291,12 +302,7 @@
data (get-in state [:pages-data page-id])]
(assoc state
:workspace-data data
:workspace-page page)))
ptk/EffectEvent
(effect [_ state stream]
;; TODO: emit join page event
)))
:workspace-page page)))))
;; --- Fetch Workspace Users
@ -728,7 +734,6 @@
ptk/WatchEvent
(watch [_ state stream]
(let [change (::tmp-change state)]
(prn "update-shape" change)
(rx/of (commit-shapes-changes [change])
#(dissoc state ::tmp-change))))))

View file

@ -11,7 +11,6 @@
[uxbox.main.constants :as c]
[uxbox.main.store :as st]))
(def profile
(-> (l/key :profile)
(l/derive st/state)))

View file

@ -93,35 +93,19 @@
(when right-sidebar?
[:& right-sidebar {:page page :layout layout}])]))
(mf/defc workspace-page
[{:keys [file-id page-id layout file flags] :as props}]
(let [page (mf/deref refs/workspace-page)]
[:> rdnd/provider {:backend rdnd/html5}
[:& messages-widget]
[:& header {:page page :layout layout :flags flags}]
(when (:colorpalette layout)
[:& colorpalette])
(when (and layout page)
[:& workspace-content {:layout layout
:flags flags
:file file
:page page}])]))
(mf/defc workspace
[{:keys [file-id page-id] :as props}]
(mf/use-effect
{:deps (mf/deps file-id page-id)
:fn #(st/emit! (dw/initialize file-id page-id))})
(mf/use-effect
{:deps (mf/deps file-id)
:fn (fn []
(st/emit! (dw/initialize-ws file-id))
#(st/emit! (dw/finalize-ws file-id)))})
(st/emit! (dw/initialize file-id page-id))
#(st/emit! (dw/finalize file-id page-id)))})
;; (mf/use-effect
;; {:deps (mf/deps file-id)
;; :fn (fn []
;; (st/emit! (dw/initialize-ws file-id))
;; #(st/emit! (dw/finalize-ws file-id)))})
;; (mf/use-effect
;; {:deps (mf/deps file-id page-id)

View file

@ -258,7 +258,6 @@
(events/unlistenByKey key1)
(events/unlistenByKey key2))))]
(mf/use-effect on-mount)
;; (prn "viewport$render")
[:*
[:& coordinates {:zoom zoom}]
[:svg.viewport {:width (* c/viewport-width zoom)