mirror of
https://github.com/penpot/penpot.git
synced 2025-06-05 23:21:38 +02:00
⬆️ Upgrade to beicon2 (part1)
This commit is contained in:
parent
ecee15af5b
commit
96f5a33f5f
151 changed files with 482 additions and 433 deletions
|
@ -19,7 +19,8 @@
|
|||
[app.util.storage :refer [storage]]
|
||||
[app.util.timers :as ts]
|
||||
[app.util.webapi :as wapi]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[beicon.v2.operators :as rxo]
|
||||
[goog.functions :as f]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
|
@ -35,8 +36,8 @@
|
|||
(let [[state reset-state!] (mf/useState #(if (satisfies? IDeref ob) @ob nil))]
|
||||
(mf/useEffect
|
||||
(fn []
|
||||
(let [sub (rx/subscribe ob #(reset-state! %))]
|
||||
#(rx/cancel! sub)))
|
||||
(let [sub (rx/sub! ob #(reset-state! %))]
|
||||
#(rx/dispose! sub)))
|
||||
#js [ob])
|
||||
state))
|
||||
|
||||
|
@ -106,7 +107,7 @@
|
|||
|
||||
cleanup
|
||||
(fn []
|
||||
(some-> (:subscr @state) rx/unsub!)
|
||||
(some-> (:subscr @state) rx/dispose!)
|
||||
(swap! state (fn [state]
|
||||
(-> state
|
||||
(cancel-timer)
|
||||
|
@ -217,7 +218,7 @@
|
|||
(mf/use-effect
|
||||
deps
|
||||
(fn []
|
||||
(let [sub (->> stream (rx/subs on-subscribe))]
|
||||
(let [sub (->> stream (rx/subs! on-subscribe))]
|
||||
#(rx/dispose! sub))))))
|
||||
|
||||
;; https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
|
||||
|
@ -339,8 +340,8 @@
|
|||
|
||||
intersecting?)))
|
||||
|
||||
(rx/dedupe))
|
||||
subs (rx/subscribe stream update-state!)]
|
||||
(rx/pipe (rxo/distinct-contiguous)))
|
||||
subs (rx/sub! stream update-state!)]
|
||||
(.observe ^js @intersection-observer node)
|
||||
(fn []
|
||||
(.unobserve ^js @intersection-observer node)
|
||||
|
@ -383,7 +384,7 @@
|
|||
(let [node (mf/ref-val rowref)
|
||||
mnt? (volatile! true)
|
||||
sub (->> (wapi/observe-resize node)
|
||||
(rx/subs (fn [entries]
|
||||
(rx/subs! (fn [entries]
|
||||
(let [row (first entries)
|
||||
row-rect (.-contentRect ^js row)
|
||||
row-width (.-width ^js row-rect)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue