Skip to content

Fix Memory Leak in SearchJournalEntryComponent , Added OnDestroy + takeUntil Cleanup#3550

Open
Manishnemade12 wants to merge 1 commit intoopenMF:devfrom
Manishnemade12:suubscription
Open

Fix Memory Leak in SearchJournalEntryComponent , Added OnDestroy + takeUntil Cleanup#3550
Manishnemade12 wants to merge 1 commit intoopenMF:devfrom
Manishnemade12:suubscription

Conversation

@Manishnemade12
Copy link
Copy Markdown

@Manishnemade12 Manishnemade12 commented Apr 30, 2026

Description

This PR resolves a significant memory leak and potential performance degradation in the SearchJournalEntryComponent. Previously, the component accumulated multiple live RxJS subscriptions (for form value changes, sorting, and pagination) every time a user visited the page, because it lacked proper teardown logic when the component was destroyed.

To fix this, the standard Angular OnDestroy lifecycle hook was implemented along with an RxJS Subject and the takeUntil pattern. This ensures that all active subscriptions are automatically cleaned up when the component unmounts, preventing stale callbacks from executing and freeing up memory efficiently.

No new external dependencies are required for this change.

Screenshots, if any

(Please add memory profiler heap snapshots showing Before/After if required by the reviewers.)

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • If you have multiple commits please combine them into one commit by squashing them.

  • Read and understood the contribution guidelines at web-app/.github/CONTRIBUTING.md.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced resource cleanup in the journal entry search component to improve stability and prevent potential memory-related issues when navigating or interacting with the search interface.

…n search journal entry component subscriptions
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'pre_merge_checks'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 74054e62-babd-4c87-95a1-669e6e04fd49

📥 Commits

Reviewing files that changed from the base of the PR and between ad493a1 and 2f96467.

📒 Files selected for processing (1)
  • src/app/accounting/search-journal-entry/search-journal-entry.component.ts

Walkthrough

The SearchJournalEntryComponent now implements the OnDestroy lifecycle hook with a destroy$ Subject to ensure all RxJS subscriptions are properly cleaned up when the component is destroyed, preventing potential memory leaks.

Changes

Cohort / File(s) Summary
Memory Leak Prevention
src/app/accounting/search-journal-entry/search-journal-entry.component.ts
Implements OnDestroy lifecycle hook and adds a destroy$ Subject. All existing subscriptions (valueChanges, sort.sortChange, merged sort/paginator stream) updated to use takeUntil(this.destroy$) operator for proper cleanup on component destruction.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • alberto-art3ch
  • IOhacker
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: fixing a memory leak by implementing OnDestroy and takeUntil in SearchJournalEntryComponent. It directly matches the changeset's core objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

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