mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 08:20:45 -05:00
♻️ Remove rx/first
calls and replaced by safer rx/take 1
This commit is contained in:
parent
b8f2f3e34d
commit
fbbb079599
6 changed files with 9 additions and 9 deletions
|
@ -196,7 +196,7 @@
|
|||
|
||||
(->> stream
|
||||
(rx/filter #(= ::dwc/index-initialized %))
|
||||
(rx/first)
|
||||
(rx/take 1)
|
||||
(rx/map #(file-initialized bundle)))))))))
|
||||
|
||||
ptk/EffectEvent
|
||||
|
@ -1636,7 +1636,7 @@
|
|||
(->> (rx/concat paste-transit-str
|
||||
paste-plain-text-str
|
||||
paste-image-str)
|
||||
(rx/first)
|
||||
(rx/take 1)
|
||||
(rx/catch
|
||||
(fn [err]
|
||||
(js/console.error "Clipboard error:" err)
|
||||
|
|
|
@ -219,7 +219,7 @@
|
|||
|
||||
;; Hide the modal if the stop event is emitted
|
||||
(->> stop?
|
||||
(rx/first)
|
||||
(rx/take 1)
|
||||
(rx/map #(md/hide))))))
|
||||
|
||||
ptk/UpdateEvent
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
(rx/of (handle-drawing type))
|
||||
(->> stream
|
||||
(rx/filter (ptk/type? ::common/handle-finish-drawing) )
|
||||
(rx/first)
|
||||
(rx/take 1)
|
||||
(rx/map #(fn [state] (update state :workspace-drawing dissoc :lock)))))))))))
|
||||
|
||||
(defn handle-drawing
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
(let [opacity-events (->> stream ;; Stop buffering after time without opacities
|
||||
(rx/filter (ptk/type? ::pressed-opacity))
|
||||
(rx/buffer-time 600)
|
||||
(rx/first)
|
||||
(rx/take 1)
|
||||
(rx/map #(set-opacity (calculate-opacity (map deref %)))))]
|
||||
(rx/concat
|
||||
(rx/of (set-opacity (calculate-opacity [opacity]))) ;; First opacity is always fired
|
||||
|
|
|
@ -523,7 +523,7 @@
|
|||
(watch [_ _ stream]
|
||||
(->> stream
|
||||
(rx/filter (ptk/type? ::dws/duplicate-selected))
|
||||
(rx/first)
|
||||
(rx/take 1)
|
||||
(rx/map #(start-move from-position))))))
|
||||
|
||||
(defn- start-move
|
||||
|
@ -612,7 +612,7 @@
|
|||
(rx/filter #(= direction (deref %))))
|
||||
stopper (->> move-events
|
||||
(rx/debounce 100)
|
||||
(rx/first))
|
||||
(rx/take 1))
|
||||
scale (if shift? (gpt/point (:big nudge)) (gpt/point (:small nudge)))
|
||||
mov-vec (gpt/multiply (get-displacement direction) scale)]
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
:frame-id frame-id
|
||||
:axis coord
|
||||
:ranges [[(- value 0.5) (+ value 0.5)]]})
|
||||
(rx/first)
|
||||
(rx/take 1)
|
||||
(rx/map (remove-from-snap-points remove-snap?))
|
||||
(rx/map flatten-to-points))))
|
||||
|
||||
|
@ -98,7 +98,7 @@
|
|||
:frame-id frame-id
|
||||
:axis coord
|
||||
:ranges ranges})
|
||||
(rx/first)
|
||||
(rx/take 1)
|
||||
(rx/map (remove-from-snap-points remove-snap?))
|
||||
(rx/map (get-min-distance-snap points coord)))))
|
||||
|
||||
|
|
Loading…
Reference in a new issue