ublo-lib 1.13.1 → 1.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -99,9 +99,11 @@ const usePackages = (defaultPopupContent, setPopupContent, cartUrl, selector = "
|
|
|
99
99
|
section.addEventListener("click", onPackageClick);
|
|
100
100
|
}, [callback, onPackageClick]);
|
|
101
101
|
const cleanup = React.useCallback(section => {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
if (section) {
|
|
103
|
+
const zone = section.closest(".cms");
|
|
104
|
+
zone.removeEventListener("ublo-section-created", callback);
|
|
105
|
+
section.removeEventListener("click", onPackageClick);
|
|
106
|
+
}
|
|
105
107
|
}, [callback, onPackageClick]);
|
|
106
108
|
React.useEffect(() => {
|
|
107
109
|
const sections = Array.from(document.querySelectorAll(selector));
|