Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve docs to point to memory leak if ngOnDestroy is overridden in … #4001

Merged
merged 5 commits into from
Aug 19, 2023

Conversation

ValentinBossi
Copy link
Contributor

@ValentinBossi ValentinBossi commented Aug 11, 2023

…own component store

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ x] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Closes #3982

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x ] No

Other information

@netlify
Copy link

netlify bot commented Aug 11, 2023

Deploy Preview for ngrx-io ready!

Name Link
🔨 Latest commit 67fbbc8
🔍 Latest deploy log https://app.netlify.com/sites/ngrx-io/deploys/64db715f88c0cb00082855c8
😎 Deploy Preview https://deploy-preview-4001--ngrx-io.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ValentinBossi ValentinBossi marked this pull request as ready for review August 11, 2023 19:51
@@ -14,6 +14,18 @@ Currently, Angular provides initializer tokens in a few areas. The `APP_INITIALI

</div>

<div class="alert is-important">

**Note:** If you override the `ngOnDestroy` method in your component store, you need to call `super.ngOnDestroy()`. Otherwise a memory leak may occur.
Copy link
Member

Choose a reason for hiding this comment

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

This would go better down at the bottom with the OnDestroy section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

absolutely. i changed that.

@@ -138,6 +138,18 @@ ComponentStore also implements the `OnDestroy` interface from `@angulare/core` t

It also exposes a `destroy$` property on the ComponentStore class that can be used instead of manually creating a `Subject` to unsubscribe from any observables created in the component.

<div class="alert is-important">
Copy link
Member

@brandonroberts brandonroberts Aug 14, 2023

Choose a reason for hiding this comment

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

Let's not put the code snippet inside the div.alert. Put it after the closing div

Copy link
Member

Choose a reason for hiding this comment

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

To extend upon this comment, I think it would be better to the full snippet.
Also, instead of using the markdown code-block syntax, it's better to put wrap the code within a <code-example header="books-page.component.ts"> tag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok i added the code snipped

Copy link
Member

@timdeschryver timdeschryver left a comment

Choose a reason for hiding this comment

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

Thanks @ValentinBossi !

@brandonroberts brandonroberts merged commit 3e9022a into ngrx:main Aug 19, 2023
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.

Potential Memory Leak Issue in ngrx Store-Component
3 participants