Skip to content

fix: add OnDestroy to FeedComponent to prevent memory leaks#198

Open
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin/1772660982-fix-feed-memory-leak
Open

fix: add OnDestroy to FeedComponent to prevent memory leaks#198
devin-ai-integration[bot] wants to merge 1 commit intomasterfrom
devin/1772660982-fix-feed-memory-leak

Conversation

@devin-ai-integration
Copy link

Summary

Adds the OnDestroy lifecycle hook to FeedComponent to unsubscribe from typeSub and pageSub when the component is destroyed. Previously, navigating away from feed pages left these subscriptions alive, causing memory leaks and potential ghost updates from stale callbacks.

Review & Testing Checklist for Human

  • Verify the inner subscription is not also leaking: Inside pageSub's callback (ngOnInit line 47–55), fetchFeed(...).subscribe(...) creates a new subscription on every route param change that is never stored or unsubscribed. This PR does not address that inner subscription — confirm whether it also needs cleanup (it likely does if users navigate between pages rapidly).
  • Run ng test to confirm existing tests still pass — tests were not executed during this session.
  • Manual test: Navigate between feed pages and other routes repeatedly; confirm via browser DevTools (Performance/Memory tab) that subscriptions are no longer accumulating.

Notes

Implement OnDestroy lifecycle hook to unsubscribe from typeSub and
pageSub subscriptions when the component is destroyed. Previously,
navigating away from feed pages would leave stale subscriptions
running, causing memory leaks and potential ghost updates.

Co-Authored-By: Matthew Guerra <matthew.guerra@cognition.ai>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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.

1 participant