Currently, a 'reaction' with an explicit target component, can stop working when :parent is set in the opts. But the :parent should only affect reactions that use :parent as the target:
In this test, the app-state change is silently lost:
(deftest parent-reaction-test
(let [c1 (reacl/class "child" this state []
render (dom/div)
handle-message
(fn [msg]
(reacl/return :app-state msg)))
received (atom nil)
p1 (reacl/class "parent" this state [gparent]
render (c1 (reacl/opt :parent gparent
:reaction (reacl/reaction this identity))
state)
handle-message
(fn [msg]
(reset! received msg)
(reacl/return :app-state msg)))
g1 (reacl/class "grandparent" this []
local-state [state nil]
render (p1 state this))
c (tu/mount g1)]
(tu/send-message! (xpath/select c (xpath/>> ** c1))
:test)
(is (= @received :test))))
Currently, a 'reaction' with an explicit target component, can stop working when
:parent
is set in theopts
. But the:parent
should only affect reactions that use:parent
as the target:In this test, the app-state change is silently lost: