diff --git a/src/areas/elementsCache.js b/src/areas/elementsCache.js index deb3c858..b78386d5 100644 --- a/src/areas/elementsCache.js +++ b/src/areas/elementsCache.js @@ -36,7 +36,7 @@ const ElementsCache = () => { }); return result; }; - + console.log("ElementsCache is rendering") useEffect(() => { if (ui.ready && interfaceSettings.current?.settings?.extracontents) { //console.log("ElementsCache can now be created") diff --git a/src/components/Controls/ContainerHelper.js b/src/components/Controls/ContainerHelper.js index 5e2adc11..480d29dd 100644 --- a/src/components/Controls/ContainerHelper.js +++ b/src/components/Controls/ContainerHelper.js @@ -27,6 +27,7 @@ const ContainerHelper = ({id, active=false}) => { const [enabled, setEnabled] = useState(active) //console.log("ContainerHelper id", id ,"active", active) + const listenerId = `listener_containerhelper_${id}`; useEffect(() => { const handleUpdateState = (msg) => { if ('isFullScreen' in msg) { @@ -45,9 +46,9 @@ const ContainerHelper = ({id, active=false}) => { } } } - eventBus.on("updateState", handleUpdateState) + eventBus.on("updateState", handleUpdateState, listenerId) return () => { - eventBus.off("updateState", handleUpdateState) + //eventBus.off("updateState", handleUpdateState,listenerId) }}) diff --git a/src/components/ExtraContent/extraContentItem.js b/src/components/ExtraContent/extraContentItem.js index 118a01af..5c0c2b63 100644 --- a/src/components/ExtraContent/extraContentItem.js +++ b/src/components/ExtraContent/extraContentItem.js @@ -42,6 +42,8 @@ const ExtraContentItem = ({ const { createNewRequest } = useHttpFn const element_id = id.replace("extra_content_", type) const refreshIntervalRef = useRef(null) + console.log(`Rendering ExtraContentItem ${id} at ${Date.now()}`); + const handleContentSuccess = useCallback((result) => { let blob @@ -95,12 +97,13 @@ const ExtraContentItem = ({ }, [loadContent]) useEffect(() => { + const listenerId = `listener_${id}`; const handleUpdateState = (msg) => { if (msg.id == id) { - console.log("Matching message for element " + id) - console.log(msg) + console.log(`Received message for ${id} with listener ${listenerId}`, msg); const element = document.getElementById(id) if ( 'forceRefresh' in msg && msg.forceRefresh) { + console.log(`Processing forceRefresh for ${id}`); loadContent() } if ('isVisible' in msg) { @@ -124,9 +127,10 @@ const ExtraContentItem = ({ } } } - eventBus.on("updateState", handleUpdateState) + eventBus.on("updateState", handleUpdateState, listenerId) return () => { - eventBus.off("updateState", handleUpdateState) + //console.log(`Removing listener ${listenerId} for ${id}`); + //eventBus.off("updateState", handleUpdateState, listenerId) } }, [id, loadContent]) @@ -277,7 +281,7 @@ const ExtraContentItem = ({ )} ), [type, refreshtime, isPaused, captureImage, togglePause]); - + console.log("Rendering :" + "