mirror of
https://github.com/penpot/penpot.git
synced 2025-06-15 17:01:39 +02:00
❇️ Change mutation listener
This commit is contained in:
parent
6cb6adc134
commit
d83459f674
4 changed files with 45 additions and 40 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
(ns app.main.ui.hooks.mutable-observer
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.logging :as log]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
|
@ -20,9 +21,12 @@
|
|||
on-mutation
|
||||
(mf/use-callback
|
||||
(mf/deps on-change)
|
||||
(fn [mutation]
|
||||
(log/debug :action "mutation" :js/mutation mutation)
|
||||
(on-change (mf/ref-val node-ref))))
|
||||
(fn [mutations]
|
||||
(let [mutations
|
||||
(->> mutations
|
||||
(remove #(= "transform" (.-attributeName ^js %))))]
|
||||
(when (d/not-empty? mutations)
|
||||
(on-change (mf/ref-val node-ref))))))
|
||||
|
||||
set-node
|
||||
(mf/use-callback
|
||||
|
@ -51,4 +55,4 @@
|
|||
(.disconnect prev-obs)
|
||||
(mf/set-ref-val! prev-obs-ref nil)))))
|
||||
|
||||
set-node))
|
||||
[node-ref set-node]))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue