Stop automatic scrolling when moving the mouse away from the category

Adds a check to clear the existing scroll interval before starting a new one in the `startAutoScroll` function within the `CategoryRow` component.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 074b0e4c-6171-43bd-aa98-f9e04623ca14
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/074b0e4c-6171-43bd-aa98-f9e04623ca14/6upLu3q
This commit is contained in:
sebastjanartic 2025-08-30 12:56:24 +00:00
parent 0d97d83050
commit 6af0b01f23

View File

@ -155,6 +155,11 @@ function CategoryRow({ category, onVideoClick }: CategoryRowProps) {
};
const startAutoScroll = (direction: 'left' | 'right') => {
// Stop any existing scrolling first
if (scrollIntervalRef.current) {
clearInterval(scrollIntervalRef.current);
}
setIsScrolling(true);
scrollIntervalRef.current = setInterval(() => {
if (scrollRef.current) {