Skip to content

Commit

Permalink
Listener cleanup bug
Browse files Browse the repository at this point in the history
  • Loading branch information
raystubbs committed May 15, 2024
1 parent 17648d2 commit 6e8ed01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/zero/component.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,11 @@ Implements web components. Require this ns to enable them.
^js/ShadowRoot shadow (:shadow @!instance-state)]
(when (pos? (get-in @!instance-state [:lifecycle-event-listener-counts "disconnect"]))
(.dispatchEvent shadow (js/Event. "disconnect" #js{:bubbles false})))
(doseq [[k listener] (:zero.core/on (gobj/get shadow dom/PROPS-SYM))]
(when (some? listener)
(if (instance? Signal k)
(sig/unlisten k [listener shadow k])
(dom/unlisten [listener shadow k]))))
(swap! !dirty disj this)
(swap! !static-state update :instances disj this)
(swap! !instance-state assoc :connected false)
Expand Down
1 change: 0 additions & 1 deletion src/zero/impl/base.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
[m [k & ks]]
(if (seq ks)
(let [new (dissoc-in (get m k) ks)]
(prn new)
(if (seq new)
(assoc m k new)
(dissoc m k)))
Expand Down

0 comments on commit 6e8ed01

Please sign in to comment.