mirror of
https://github.com/penpot/penpot.git
synced 2025-01-25 07:58:49 -05:00
Remove unused swap and reset events declared in rstore ns.
This commit is contained in:
parent
e741678f2a
commit
380aaab806
3 changed files with 5 additions and 23 deletions
|
@ -188,7 +188,7 @@
|
||||||
rs/WatchEvent
|
rs/WatchEvent
|
||||||
(-apply-watch [_ state s]
|
(-apply-watch [_ state s]
|
||||||
(letfn [(on-success [_]
|
(letfn [(on-success [_]
|
||||||
(rs/swap #(stpr/purge-page % id)))]
|
#(stpr/purge-page % id))]
|
||||||
(->> (rp/req :delete/page id)
|
(->> (rp/req :delete/page id)
|
||||||
(rx/map on-success)
|
(rx/map on-success)
|
||||||
(rx/tap callback)
|
(rx/tap callback)
|
||||||
|
|
|
@ -117,7 +117,7 @@
|
||||||
rs/WatchEvent
|
rs/WatchEvent
|
||||||
(-apply-watch [_ state s]
|
(-apply-watch [_ state s]
|
||||||
(letfn [(on-success [_]
|
(letfn [(on-success [_]
|
||||||
(rs/swap #(stpr/dissoc-project % id)))]
|
#(stpr/dissoc-project % id))]
|
||||||
(->> (rp/req :delete/project id)
|
(->> (rp/req :delete/project id)
|
||||||
(rx/map on-success)))))
|
(rx/map on-success)))))
|
||||||
|
|
||||||
|
|
|
@ -67,26 +67,8 @@
|
||||||
([event & events]
|
([event & events]
|
||||||
(run! emit! (cons event events))))
|
(run! emit! (cons event events))))
|
||||||
|
|
||||||
(defrecord SwapState [f]
|
(defonce ^:private error-handlers
|
||||||
UpdateEvent
|
(atom {}))
|
||||||
(-apply-update [_ state]
|
|
||||||
(f state)))
|
|
||||||
|
|
||||||
(defn swap
|
|
||||||
"A helper for just apply some function to state
|
|
||||||
without a need to declare additional event."
|
|
||||||
[f]
|
|
||||||
(->SwapState f))
|
|
||||||
|
|
||||||
(defn reset
|
|
||||||
"A event that resets the internal state with
|
|
||||||
the provided value."
|
|
||||||
[v]
|
|
||||||
(->SwapState (fn [_] v)))
|
|
||||||
|
|
||||||
(enable-console-print!)
|
|
||||||
|
|
||||||
(defonce ^:private error-handlers (atom {}))
|
|
||||||
|
|
||||||
(defn add-error-watcher
|
(defn add-error-watcher
|
||||||
[key callable]
|
[key callable]
|
||||||
|
@ -130,5 +112,5 @@
|
||||||
(rx/subscribe $ (fn [[event model]] (-apply-effect event model))))
|
(rx/subscribe $ (fn [[event model]] (-apply-effect event model))))
|
||||||
|
|
||||||
;; Initialize the stream machinary with initial state.
|
;; Initialize the stream machinary with initial state.
|
||||||
(emit! (swap #(merge % state)))
|
(emit! #(merge % state))
|
||||||
state-s))
|
state-s))
|
||||||
|
|
Loading…
Add table
Reference in a new issue