From 6e8ed011604effb4f9699f5916aa31d75b0e89e9 Mon Sep 17 00:00:00 2001 From: Ray Stubbs Date: Wed, 15 May 2024 12:36:48 -0600 Subject: [PATCH] Listener cleanup bug --- src/zero/component.cljs | 5 +++++ src/zero/impl/base.cljc | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/zero/component.cljs b/src/zero/component.cljs index a33a6af..c970bef 100644 --- a/src/zero/component.cljs +++ b/src/zero/component.cljs @@ -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) diff --git a/src/zero/impl/base.cljc b/src/zero/impl/base.cljc index 7449828..b8a82e4 100644 --- a/src/zero/impl/base.cljc +++ b/src/zero/impl/base.cljc @@ -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)))