Skip to content

Commit 5bc0677

Browse files
committed
fix: address coderabbit review comments
1 parent e1e2b42 commit 5bc0677

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

src/lib/animations/index.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@ export function write(
2525
}
2626
}, step);
2727

28-
signal?.addEventListener('abort', () => {
29-
clearInterval(interval);
30-
reject(new Error('Aborted'));
31-
});
28+
signal?.addEventListener(
29+
'abort',
30+
() => {
31+
clearInterval(interval);
32+
reject(new Error('Aborted'));
33+
},
34+
{ once: true }
35+
);
3236
});
3337
}
3438

@@ -59,10 +63,14 @@ export function unwrite(
5963
}
6064
}, step);
6165

62-
signal?.addEventListener('abort', () => {
63-
clearInterval(interval);
64-
reject(new Error('Aborted'));
65-
});
66+
signal?.addEventListener(
67+
'abort',
68+
() => {
69+
clearInterval(interval);
70+
reject(new Error('Aborted'));
71+
},
72+
{ once: true }
73+
);
6674
});
6775
}
6876

src/routes/(marketing)/(components)/bento/(animations)/auth.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070
}).catch(() => {});
7171
};
7272
});
73+
74+
return () => {
75+
controller?.abort();
76+
};
7377
});
7478
</script>
7579

0 commit comments

Comments
 (0)