🐛 Fix unnexpected warning (#8603)

This commit is contained in:
Eva Marco 2026-03-12 12:01:28 +01:00 committed by GitHub
parent 9b3207b06c
commit c00ef7c128
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 9 deletions

View File

@ -36,6 +36,7 @@
- Fix error activating a set with invalid shadow token applied [Taiga #13528](https://tree.taiga.io/project/penpot/issue/13528)
- Fix component "broken" after variant switch [Taiga #12984](https://tree.taiga.io/project/penpot/issue/12984)
- Fix incorrect query for file versions [Github #8463](https://github.com/penpot/penpot/pull/8463)
- Fix warning when clicking on number token pills [Taiga #13661](https://tree.taiga.io/project/penpot/issue/13661)
## 2.13.3

View File

@ -76,7 +76,11 @@
is-type-unfolded (contains? (set unfolded-token-paths) (name type))
editing-ref (mf/deref refs/workspace-editor-state)
not-editing? (empty? editing-ref)
edition (mf/deref refs/selected-edition)
objects (mf/deref refs/workspace-page-objects)
not-editing? (and (empty? editing-ref)
(not (and (some? edition)
(= :text (:type (get objects edition))))))
can-edit?
(mf/use-ctx ctx/can-edit?)
@ -137,14 +141,16 @@
(fn [event token]
(let [token (ctob/get-token tokens-lib selected-token-set-id (:id token))]
(dom/stop-propagation event)
(if (and not-editing? (seq selected-shapes) (not= (:type token) :number))
(st/emit! (dwta/toggle-token {:token token
:shape-ids selected-ids}))
(when (seq selected-shapes)
(st/emit! (ntf/show {:content (tr "workspace.tokens.error-text-edition")
:type :toast
:level :warning
:timeout 3000})))))))]
;; Number tokens can't be applied via button click
(when (not= (:type token) :number)
(if (and not-editing? (seq selected-shapes))
(st/emit! (dwta/toggle-token {:token token
:shape-ids selected-ids}))
(when (seq selected-shapes)
(st/emit! (ntf/show {:content (tr "workspace.tokens.error-text-edition")
:type :toast
:level :warning
:timeout 3000}))))))))]
[:div {:class (stl/css :token-section-wrapper)
:data-testid (dm/str "section-" (name type))}