Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Dealing with subscriptions from disabledWhile() #141

Closed
undsoft opened this issue Feb 7, 2022 · 1 comment
Closed

Dealing with subscriptions from disabledWhile() #141

undsoft opened this issue Feb 7, 2022 · 1 comment

Comments

@undsoft
Copy link
Contributor

undsoft commented Feb 7, 2022

Description

I've recently discovered that disabledWhile() returns back a Subscription.
I'm assuming it is expected that I will be the one unsubscribing in ngOnDestroy.

  1. Isn't there a way to have reactive-forms take care of this subscription without me doing anything?
  2. If not, the need to unsubscribe should probably be highlighted in the docs.
  3. We use until-destroy and having to store subscriptions and unsubscribe will make the code less pretty. Any guidance on better way to do this?

Thanks.

Proposed solution

Have reactive-forms unsubscribe from disabledWhile() Subscription automatically.
Or update docs.

Alternatives considered

Do you want to create a pull request?

No

@NetanelBasal
Copy link
Member

We can't do it automatically because the class isn't aware of life cycle hooks. When you subscribe to something, you have to unsubscribe unless you're explicitly told in the docs that it will happen automatically.

@ngneat ngneat locked and limited conversation to collaborators Feb 7, 2022
@NetanelBasal NetanelBasal converted this issue into discussion #142 Feb 7, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants