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

this.$subscribe is not a function #78

Open
diavrank opened this issue Nov 19, 2022 · 2 comments
Open

this.$subscribe is not a function #78

diavrank opened this issue Nov 19, 2022 · 2 comments

Comments

@diavrank
Copy link

Hi @Akryum , I tried to use subcriptions in Options API by using the syntax:

mounted () {
  // Subscribes to the 'threads' publication with two parameters
  this.$subscribe('thread', ['new', 10])
}

In my app, I am using both versions: this.$subscribe() and the object way { meteor: { $subscribe: [] } }. Actually, I use the second one, but the first one is important as well because I need the subscription starts on the mounted hook.

@diavrank
Copy link
Author

diavrank commented Mar 8, 2023

Hi @Akryum , have you had the chance to check this?

@hluz
Copy link

hluz commented Dec 15, 2024

Potential workaround (works for me): You can use this.$subscribe from mounted provided you also have a meteor object even if empty: meteor: {},

You can also access reactive variables for subscription parameters if you use autorun

Note: $subReady does not get setup properly, but you can set up your local data variable subReady like this:
this.subReady.subname = this.$subscribe('subname').ready and then use this.subReady instead of $subReady

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

No branches or pull requests

2 participants