Skip to content

πŸ› Bug Report: Memory Leak in SetIntervalΒ #646

@annrose2277-glitch

Description

@annrose2277-glitch

πŸ“œ Description

useEffect(() => {
// ... fetch code
const interval = setInterval(fetchEvents, 30000);
return () => clearInterval(interval);
}, [username]); // ❌ Missing dependency: fetchEvents

Issue: While cleanup function exists, fetchEvents is recreated on every render but not included in dependency array. This causes multiple intervals to be created if username doesn't change.

Impact: Memory leaks, multiple API calls, performance degradation over time.

Recommended Fix: Add fetchEvents to dependency array or move it outside useEffect.

What browsers are you seeing the problem on?

No response

πŸ“ƒ Relevant Screenshots (Links)

No response

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions