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.
This commit is contained in:
Mauricio Siu
2026-09-29 01:59:29 -06:00
parent c231c2979b
commit 382fdfc478
@@ -92,5 +92,11 @@ export const useHubSpotChat = (enabled: boolean) => {
loadWidget,
];
}
return () => {
window.hsConversationsOnReady = window.hsConversationsOnReady?.filter(
(callback) => callback !== loadWidget,
);
window.HubSpotConversations?.widget.remove();
};
}, [enabled]);
};