active-group / active-group/reacl
Setting a :parent in the opts should not break reaction handling
- Vorherrschende Sprache
- Clojure
- Sterne
- 78
- Forks
- 2
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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))))
```
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.