We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c808666 commit c80424bCopy full SHA for c80424b
packages/astro/components/ViewTransitions.astro
@@ -38,12 +38,21 @@ const { fallback = 'animate' } = Astro.props as Props;
38
39
const throttle = (cb: (...args: any[]) => any, delay: number) => {
40
let wait = false;
41
+ // During the waiting time additional events are lost.
42
+ // So repeat the callback at the end if we have swallowed events.
43
+ let onceMore = false;
44
return (...args: any[]) => {
- if (wait) return;
-
45
+ if (wait) {
46
+ onceMore = true;
47
+ return;
48
+ }
49
cb(...args);
50
wait = true;
51
setTimeout(() => {
52
+ if (onceMore) {
53
+ onceMore = false;
54
+ cb(...args);
55
56
wait = false;
57
}, delay);
58
};
0 commit comments