Skip to content

try and fix infinite loop for clips loading#36

Merged
andmoredev merged 1 commit into
mainfrom
fix-clip-reloading
Feb 13, 2026
Merged

try and fix infinite loop for clips loading#36
andmoredev merged 1 commit into
mainfrom
fix-clip-reloading

Conversation

@andmoredev

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings February 13, 2026 02:22
@andmoredev andmoredev merged commit b3c2c83 into main Feb 13, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses an infinite loop issue in the episode clips loading mechanism by wrapping the handleClipsLoaded callback with useCallback to prevent unnecessary re-renders.

Changes:

  • Memoized the handleClipsLoaded callback function using useCallback with an empty dependency array

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

setClipCounts(counts)
setClips(allClips)
}
}, [])

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

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

The useCallback has an empty dependency array, but the callback uses setClipCounts and setClips. If these setters are not stable (e.g., not from useState), or if there are any external dependencies that should trigger a new callback reference, the empty array could cause stale closures. Verify that setClipCounts and setClips are stable setter functions from useState or include them in the dependency array if needed.

Suggested change
}, [])
}, [setClipCounts, setClips])

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants