mirror of https://github.com/status-im/reagent.git
Make sure on-set is valid before allowing change of Reaction
This commit is contained in:
parent
87758ae396
commit
ce1486a7cd
|
@ -285,10 +285,10 @@
|
|||
|
||||
IReset
|
||||
(-reset! [a newval]
|
||||
(assert (ifn? on-set) "Reaction is read only.")
|
||||
(let [oldval state]
|
||||
(set! state newval)
|
||||
(when (some? on-set)
|
||||
(on-set oldval newval))
|
||||
(on-set oldval newval)
|
||||
(-notify-watches a oldval newval)
|
||||
newval))
|
||||
|
||||
|
|
Loading…
Reference in New Issue