1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-05 17:53:12 +02:00

feat: only load kapa on interaction

This commit is contained in:
FredrikOseberg 2025-08-11 14:30:58 +02:00
parent 2d9f5748f3
commit 04453c5663
No known key found for this signature in database
GPG Key ID: 282FD8A6D8F9BCF0

View File

@ -53,8 +53,6 @@ export default function Root({ children }: { children: React.ReactNode }) {
document.head.appendChild(script); document.head.appendChild(script);
}; };
const timeoutId = setTimeout(loadKapaWidget, 3000);
const handleUserInteraction = () => { const handleUserInteraction = () => {
loadKapaWidget(); loadKapaWidget();
window.removeEventListener('scroll', handleUserInteraction); window.removeEventListener('scroll', handleUserInteraction);
@ -78,7 +76,6 @@ export default function Root({ children }: { children: React.ReactNode }) {
}); });
return () => { return () => {
clearTimeout(timeoutId);
window.removeEventListener('scroll', handleUserInteraction); window.removeEventListener('scroll', handleUserInteraction);
window.removeEventListener('click', handleUserInteraction); window.removeEventListener('click', handleUserInteraction);
window.removeEventListener('touchstart', handleUserInteraction); window.removeEventListener('touchstart', handleUserInteraction);