🐛 Fix dissoc error when detaching stroke color from library (#8738)

* 🐛 Fix dissoc error when detaching stroke color from library

The detach-value function in color-row was only passing index to
on-detach, but the stroke's on-color-detach handler expects both
index and color arguments. This caused a protocol error when trying
to dissoc from a number instead of a map.

Signed-off-by: Andrey Antukh <niwi@niwi.nz>

* 🐛 Fix crash when detaching color asset from stroke

The color_row detach-value callback calls on-detach with (index, color),
but stroke_row's local on-color-detach wrapper only took a single argument
(fn [color] ...), so it received index as color and passed it to
stroke.cljs which then called (dissoc index :ref-id :ref-file), crashing
with 'No protocol method IMap.-dissoc defined for type number'.

Fix the wrapper to accept (fn [_ color] ...) so it correctly ignores the
index passed by color_row (it already has index in the closure) and
forwards the actual color map to the parent handler.

Signed-off-by: Andrey Antukh <niwi@niwi.nz>

---------

Signed-off-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
Andrey Antukh 2026-03-24 15:35:32 +01:00 committed by GitHub
parent f88e287357
commit 750e8a9d51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -205,10 +205,10 @@
detach-value
(mf/use-fn
(mf/deps on-detach index)
(mf/deps on-detach index color)
(fn [_]
(when on-detach
(on-detach index))))
(on-detach index color))))
handle-select
(mf/use-fn

View File

@ -80,7 +80,7 @@
on-color-detach
(mf/use-fn
(mf/deps index on-color-detach)
(fn [color]
(fn [_ color]
(on-color-detach index color)))
on-remove