From 382fdfc478697744538f6cf430b7fbb114948087 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Tue, 29 Sep 2026 01:59:29 -0600 Subject: [PATCH] fix(cloud): remove HubSpot chat widget when dashboard unmounts Logout navigates client-side to the sign-in page, so the widget (mounted outside React) stayed visible after a startup user logged out. --- apps/dokploy/components/shared/analytics.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/dokploy/components/shared/analytics.tsx b/apps/dokploy/components/shared/analytics.tsx index ab1acb283..ac00db958 100644 --- a/apps/dokploy/components/shared/analytics.tsx +++ b/apps/dokploy/components/shared/analytics.tsx @@ -92,5 +92,11 @@ export const useHubSpotChat = (enabled: boolean) => { loadWidget, ]; } + return () => { + window.hsConversationsOnReady = window.hsConversationsOnReady?.filter( + (callback) => callback !== loadWidget, + ); + window.HubSpotConversations?.widget.remove(); + }; }, [enabled]); };