Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions src/routes/(marketing)/(components)/bento/(animations)/auth.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@
let currentAnimation: WriteAnimation | null = null;

$effect(() => {
inView(
// The write animation can settle after the component has been destroyed
// (e.g. the user clicks the card mid-animation), by which point
// `bind:this` has already reset `button` to null.
const pulseButton = () => {
if (!button) return;
animate(button, { scale: [1, 0.95, 1] }, { duration: 0.25 });
};

const stopInView = inView(
container,
() => {
if (!isMobile()) return;
Expand All @@ -28,9 +36,7 @@
1000,
password.length
);
currentAnimation.then(() => {
animate(button, { scale: [1, 0.95, 1] }, { duration: 0.25 });
});
currentAnimation.then(pulseButton);
return () => {
currentAnimation?.cancel();
currentAnimation = unwrite(
Expand All @@ -43,14 +49,12 @@
{ amount: 'all' }
);

hover(container, () => {
const stopHover = hover(container, () => {
if (isMobile()) return;

currentAnimation?.cancel();
currentAnimation = write('•••••••••••••', (v) => (password = v), 1000, password.length);
currentAnimation.then(() => {
animate(button, { scale: [1, 0.95, 1] }, { duration: 0.25 });
});
currentAnimation.then(pulseButton);
return () => {
currentAnimation?.cancel();
currentAnimation = unwrite(
Expand All @@ -60,6 +64,13 @@
);
};
});

return () => {
stopInView();
stopHover();
currentAnimation?.cancel();
currentAnimation = null;
};
});
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
let shouldAnimate = $state<boolean>(false);

$effect(() => {
hover(container, () => {
const stopHover = hover(container, () => {
if (isMobile()) return;
animate(
table,
Expand Down Expand Up @@ -99,7 +99,7 @@
};
});

inView(
const stopInView = inView(
container,
() => {
if (!isMobile()) return;
Expand Down Expand Up @@ -137,6 +137,11 @@
},
{ amount: 'all' }
);

return () => {
stopHover();
stopInView();
Comment on lines +140 to +143

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Active animations survive teardown

stopHover() and stopInView() only detach Motion's event and observer handlers; they do not stop animations already started by their callbacks. Navigating away during an animation therefore leaves work running against the detached card until completion; retain and stop the animation controls here and in the equivalent messaging, realtime, and storage cleanup paths.

Knowledge Base Used: Marketing pages

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/routes/(marketing)/(components)/bento/(animations)/databases.svelte
Line: 140-143

Comment:
**Active animations survive teardown**

`stopHover()` and `stopInView()` only detach Motion's event and observer handlers; they do not stop animations already started by their callbacks. Navigating away during an animation therefore leaves work running against the detached card until completion; retain and stop the animation controls here and in the equivalent messaging, realtime, and storage cleanup paths.

**Knowledge Base Used:** [Marketing pages](https://app.greptile.com/appwrite/-/custom-context/knowledge-base/appwrite/website/-/docs/marketing-pages.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex

};
});
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
$effect(() => {
baseWidth = activeCommand.offsetWidth;

hover(container, () => {
const stopHover = hover(container, () => {
if (isMobile()) return;

widthAnim?.stop();
Expand All @@ -46,7 +46,7 @@
};
});

inView(
const stopInView = inView(
container,
() => {
if (!isMobile()) return;
Expand All @@ -70,6 +70,13 @@
},
{ amount: 'all' }
);

return () => {
stopHover();
stopInView();
widthAnim?.stop();
widthAnim = null;
};
});
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
[notification, { opacity: 1, y: 0, filter: 'blur(0px)' }, { duration: 0.2, at: 0.15 }]
];

inView(
const stopInView = inView(
container,
() => {
if (!isMobile()) return;
Expand All @@ -39,14 +39,19 @@
{ amount: 'all' }
);

hover(container, () => {
const stopHover = hover(container, () => {
if (isMobile()) return;
animate(to);

return () => {
animate(from);
};
});

return () => {
stopInView();
stopHover();
};
});
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
[topRightCursor, { scale: 1 }, { duration: 0.25, at: 0.35 }]
];

inView(
const stopInView = inView(
container,
() => {
if (!isMobile()) return;
Expand All @@ -47,14 +47,19 @@
{ amount: 'all' }
);

hover(container, () => {
const stopHover = hover(container, () => {
if (isMobile()) return;
animate(to);

return () => {
animate(from);
};
});

return () => {
stopInView();
stopHover();
};
});
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@
];

let shouldAnimate = $state<boolean>(false);
let secondsAnimation: ReturnType<typeof animate> | null = null;

$effect(() => {
hover(container, () => {
const stopHover = hover(container, () => {
if (isMobile()) return;

shouldAnimate = true;
Expand All @@ -57,6 +58,7 @@
onUpdate: (latest) => (seconds = +latest.toFixed()),
duration: 44
});
secondsAnimation = animation;

currentAnimation?.cancel();
currentAnimation = write(
Expand All @@ -82,7 +84,7 @@
};
});

inView(
const stopInView = inView(
container,
() => {
if (!isMobile()) return;
Expand All @@ -92,6 +94,7 @@
onUpdate: (latest) => (seconds = +latest.toFixed()),
duration: 44
});
secondsAnimation = animation;

currentAnimation?.cancel();
currentAnimation = write(
Expand All @@ -118,6 +121,15 @@
},
{ amount: 'all' }
);

return () => {
stopHover();
stopInView();
secondsAnimation?.stop();
secondsAnimation = null;
currentAnimation?.cancel();
currentAnimation = null;
};
});
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
let image: HTMLElement;

$effect(() => {
hover(container, () => {
const stopHover = hover(container, () => {
if (isMobile()) return;

animate(image, { borderRadius: '24px', filter: 'grayscale(25%)' }, { duration: 0.2 });
Expand All @@ -27,7 +27,7 @@
};
});

inView(
const stopInView = inView(
container,
() => {
if (!isMobile()) return;
Expand All @@ -53,6 +53,11 @@
amount: 'all'
}
);

return () => {
stopHover();
stopInView();
};
});
</script>

Expand Down