mirror of
https://github.com/penpot/penpot.git
synced 2026-05-30 04:08:08 +00:00
Merge pull request #9745 from penpot/superalex-fix-numeric-input-unmount
🐛 Fix commit pending numeric input on unmount without blur side effects
This commit is contained in:
commit
20c6da2138
@ -332,6 +332,7 @@
|
|||||||
(fn [event]
|
(fn [event]
|
||||||
(let [text (dom/get-target-val event)]
|
(let [text (dom/get-target-val event)]
|
||||||
(mf/set-ref-val! raw-value* text)
|
(mf/set-ref-val! raw-value* text)
|
||||||
|
(mf/set-ref-val! dirty-ref true)
|
||||||
(reset! filter-id* text))))
|
(reset! filter-id* text))))
|
||||||
|
|
||||||
on-token-apply
|
on-token-apply
|
||||||
@ -389,12 +390,21 @@
|
|||||||
(reset! is-open* false)))
|
(reset! is-open* false)))
|
||||||
|
|
||||||
(when (mf/ref-val dirty-ref)
|
(when (mf/ref-val dirty-ref)
|
||||||
(apply-value (mf/ref-val raw-value*)))
|
(apply-value (mf/ref-val raw-value*))
|
||||||
|
(mf/set-ref-val! dirty-ref false))
|
||||||
(when (fn? on-blur)
|
(when (fn? on-blur)
|
||||||
(on-blur event))
|
(on-blur event))
|
||||||
(dom/blur! (mf/ref-val ref))))
|
(dom/blur! (mf/ref-val ref))))
|
||||||
|
|
||||||
handle-unmount (h/use-ref-callback handle-blur)
|
commit-pending-on-unmount
|
||||||
|
(mf/use-fn
|
||||||
|
(mf/deps apply-value)
|
||||||
|
(fn []
|
||||||
|
(when (mf/ref-val dirty-ref)
|
||||||
|
(apply-value (mf/ref-val raw-value*))
|
||||||
|
(mf/set-ref-val! dirty-ref false))))
|
||||||
|
|
||||||
|
handle-unmount (h/use-ref-callback commit-pending-on-unmount)
|
||||||
|
|
||||||
on-key-down
|
on-key-down
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user