Merge pull request #4805 from penpot/superalex-fix-selected-colors-do-not-appear-in-color-palette

🐛 Selected colors do not appear in the color palette
This commit is contained in:
Andrey Antukh 2024-06-26 15:04:40 +02:00 committed by GitHub
commit 16a0e1f578
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -609,9 +609,13 @@
(assoc :type :color))))))))
ptk/WatchEvent
(watch [_ state _]
;; Type can be null, because the colorpicker can be closed while a color image finish its upload
(when (and add-recent? (some? (:type state)))
(let [formated-color (get-color-from-colorpicker-state (:colorpicker state))]
(let [selected-type (-> state
:colorpicker
:type)
formated-color (get-color-from-colorpicker-state (:colorpicker state))
;; Type is set to color on closing the colorpicker, but we can can close it while still uploading an image fill
ignore-color? (and (= selected-type :color) (nil? (:color formated-color)))]
(when (and add-recent? (not ignore-color?))
(rx/of (dwl/add-recent-color formated-color)))))))
(defn update-colorpicker-gradient