0
Fork 0
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:
alonso.torres 2022-02-03 18:30:25 +01:00
parent b8f2f3e34d
commit fbbb079599
6 changed files with 9 additions and 9 deletions

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)]

View file

@ -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)))))