Skip to content

Commit 369b29f

Browse files
committed
add timeout/context cleanup (ai suggestion)
1 parent cba219d commit 369b29f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/lib/utils/Popper.svelte

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,16 @@
215215
timeout = setTimeout(finish_change, triggerDelay);
216216
}
217217
218+
$effect(() => {
219+
return () => {
220+
if (timeout) {
221+
clearTimeout(timeout);
222+
timeout = undefined;
223+
}
224+
context = undefined;
225+
};
226+
});
227+
218228
// finish_change is called after debouncing calls to start_change.
219229
function finish_change() {
220230
if (!context) return;

0 commit comments

Comments
 (0)