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

Is using the subscribe inside subscriptions is a good idea? #67

Closed
coun7zero opened this issue Feb 2, 2018 · 4 comments
Closed

Is using the subscribe inside subscriptions is a good idea? #67

coun7zero opened this issue Feb 2, 2018 · 4 comments
Labels

Comments

@coun7zero
Copy link

I want to use a stream with observableMethods into mounted () { with this.$subscribeTo but then I have an error:

Property or method "foo" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See...

When I use that into subscriptions everything is all right but I have to subscribe that observable so is it a good place for that? Is using the subscribe inside subscriptions guarantee unsubscribe before component will be destroyed?

@regou
Copy link
Collaborator

regou commented Feb 5, 2018

Calling subscribe by yourself without vue-rx knowing is guaranteed NOT going to auto unsubscribe.

@regou
Copy link
Collaborator

regou commented Feb 7, 2018

@coun7zero BTW, You may use takeUntil(beforeDestroy$) to do auto unsub

@coun7zero
Copy link
Author

@regou good point, thank you :)

@dews
Copy link

dews commented Feb 22, 2023

Use takeUntil(this.$eventToObservable("hook:beforeDestroy"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants