-
Notifications
You must be signed in to change notification settings - Fork 37
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
Unable to access component methods or data #61
Comments
Still experiencing this issue. |
Where is |
A while ago I changed something that resolved this issue, I could not pinpoint what it was. So now I have a component where everything is working as expected:
And the other component that I was working on today where I am experiencing the same issue as described before.
Which results in a I have tried recompiling multiple times. |
After some hours of debugging I found the following: I made a simple test component named
I have a page where I initialize this component
Whener I use a v-for to decide to render the component it all works as expected.
edit: Using I will try to create a demo project one of these days. |
" It looks like the context of the channels {} block seems to be changing and can not handle multiple subscription within the same (parent) component." Can confirm! If the subscription is in a parent component, the child components with subscriptions have the context of the parent. |
The problem is, that actioncable-vue uses Vue 3 don't uses Here two workarounds for options API and composition API. Options API/* cable.js: Small constant export to use it as mixin. */
export const ActionCable = {
beforeCreate() {
this._uid = this.$.uid
},
}
/* In the component include cable.js as mixin. */
import { ActionCable } from 'cable.js'
export default {
...
mixins: [ActionCable],
...
} Composition APIimport { getCurrentInstance } from 'vue'
...
app.mixin({
beforeCreate() {
this._uid = getCurrentInstance().uid
},
}) Related to #49: |
Describe the bug
I'm trying to call a method within my component when ever I receive a websocket call.
However method or data calls within one of the channel methods (connected, received etc.) will throw an error.
How do I access my the data and methods of my component?
To Reproduce
Like the documentation I have declared my channel like this in the component.
Expected behaviour
Screenshots

Whenever the the websocket update is triggerd
Plugin version (please complete the following information):
In my yarn.lock
Additional context
I am using quasar
The text was updated successfully, but these errors were encountered: