0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-07 15:39:42 -05:00

Fix setting token to own path

This commit is contained in:
Florian Schroedl 2024-07-01 10:30:03 +02:00
parent 9d637cbe5e
commit ec511cc589

View file

@ -8,6 +8,7 @@
(:require-macros [app.main.style :as stl]) (:require-macros [app.main.style :as stl])
(:require (:require
["lodash.debounce" :as debounce] ["lodash.debounce" :as debounce]
[app.common.data :as d]
[app.main.data.modal :as modal] [app.main.data.modal :as modal]
[app.main.data.tokens :as dt] [app.main.data.tokens :as dt]
[app.main.store :as st] [app.main.store :as st]
@ -140,9 +141,15 @@ Token names should only contain letters and digits separated by . characters.")}
{::mf/wrap-props false} {::mf/wrap-props false}
[{:keys [token token-type] :as _args}] [{:keys [token token-type] :as _args}]
(let [tokens (sd/use-resolved-workspace-tokens) (let [tokens (sd/use-resolved-workspace-tokens)
token-path (mf/use-memo
(mf/deps (:name token))
#(wtt/token-name->path (:name token)))
tokens-tree (mf/use-memo tokens-tree (mf/use-memo
(mf/deps tokens) (mf/deps token-path tokens)
#(wtt/token-names-tree tokens)) (fn []
(-> (wtt/token-names-tree tokens)
;; Allow setting editing token to it's own path
(d/dissoc-in token-path))))
;; Name ;; Name
name-ref (mf/use-var (:name token)) name-ref (mf/use-var (:name token))