mirror of
https://github.com/penpot/penpot.git
synced 2026-05-10 18:48:23 +00:00
Closing the fill dialog while an image-fill upload is still in flight (or while a gradient is mid-edit) leaves the colorpicker's current-color with only :opacity — no :image, :gradient, or :color. update-colorpicker-color's WatchEvent then constructed `(add-recent-color partial)`, which runs the value through `clr/check-color` and threw "expected valid color". The user saw an Internal Assertion Error toast and lost the in-flight upload. The existing `ignore-color?` guard reads `:type` from the *output* of `get-color-from-colorpicker-state` — but that helper strips :type from its result, so the guard never actually fires. Add a schema-based gate (same validator add-recent-color itself uses) right before `rx/of`, so a partial selection is silently dropped instead of crashing the workspace. Behaviour for fully-valid colors is unchanged. Tests cover three cases: (1) a partial image-tab state with only :opacity returns nil from watch (was: throws); (2) the same partial shape on the color tab also returns nil — pinning down that the prior :type guard wouldn't have caught it; (3) a fully-populated plain color still produces a watch observable so the guard isn't over-eager. Closes #8443 Co-authored-by: Andrey Antukh <niwi@niwi.nz>