Skip to content

Commit 8ab675d

Browse files
authored
Restrict wave animation to the landing page (#3411)
Restrict wave animation to the landing page.
1 parent da6bd0b commit 8ab675d

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/frontend/src/routes/(new-styling)/+page.svelte

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,19 @@
6666
},
6767
];
6868
69-
onMount(async () => {
70-
setTimeout(
71-
async () =>
72-
await triggerDropWaveAnimation({ containerHeight: "h-[640px]" }),
73-
);
74-
});
75-
76-
onDestroy(() => {
77-
void clearDropWaveAnimation();
69+
// Only trigger the drop wave animation 100ms after the page has loaded,
70+
// so we can cancel it if navigated to another route in that time window.
71+
onMount(() => {
72+
let cancelled = false;
73+
setTimeout(() => {
74+
if (!cancelled) {
75+
void triggerDropWaveAnimation({ containerHeight: "h-[640px]" });
76+
}
77+
}, 100);
78+
return () => {
79+
cancelled = true;
80+
void clearDropWaveAnimation();
81+
};
7882
});
7983
</script>
8084

0 commit comments

Comments
 (0)