mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
⚡ Extract on-name-input-focus as namespace-level private function
The callback had no dependencies on component-local state or props, making it a pure function that can be hoisted to a defn-. This avoids recreating the same callback identity on every render of version-entry*.
This commit is contained in:
parent
c1f587d0da
commit
17b217cfb4
@ -77,6 +77,10 @@
|
||||
(assoc item :index index)))
|
||||
(reverse)))
|
||||
|
||||
(defn- on-name-input-focus
|
||||
[event]
|
||||
(dom/select-text! (dom/get-target event)))
|
||||
|
||||
(mf/defc version-entry*
|
||||
{::mf/private true}
|
||||
[{:keys [entry current-profile on-preview on-restore on-delete on-rename on-lock on-unlock on-edit on-cancel-edit is-editing]}]
|
||||
@ -132,11 +136,6 @@
|
||||
(when on-unlock
|
||||
(on-unlock (:id entry)))))
|
||||
|
||||
on-name-input-focus
|
||||
(mf/use-fn
|
||||
(fn [event]
|
||||
(dom/select-text! (dom/get-target event))))
|
||||
|
||||
on-name-input-blur
|
||||
(mf/use-fn
|
||||
(mf/deps entry on-rename on-cancel-edit)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user