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

vue 3 - channel callback contexts are broken due to relying on vm._uid #49

Closed
tjk opened this issue Apr 26, 2021 · 6 comments
Closed

vue 3 - channel callback contexts are broken due to relying on vm._uid #49

tjk opened this issue Apr 26, 2021 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@tjk
Copy link

tjk commented Apr 26, 2021

With multiple subscribed channels mounted at the same time, the contexts object (and other stuff) which relies on context._uid clashes which causes binding issues and maybe other things.

This seems to work as a stopgap, wasn't sure the best approach in the library to use...

import { getCurrentInstance } from 'vue'
/* ... */
app.mixin({
  created() {
    this._uid = getCurrentInstance().uid
  },
})
@tjk tjk added the bug Something isn't working label Apr 26, 2021
@mclintprojects
Copy link
Owner

This is happening in Vue 3.x, yes? @tjk

@tjk
Copy link
Author

tjk commented Dec 29, 2021

Yes, discovered this when I worked on a vue 3 migration. We've since started using @rails/actioncable directly so I can't say whether this is still the case, sorry. Feel free to close! (although given someone hearted the issue there is a chance it is affecting others?)

@iuri-gg
Copy link

iuri-gg commented Nov 22, 2023

having same issue - vue3 with action cable subscribing multiple times in different components causing issue. Any pointers how to resolve this?

@phlegx
Copy link

phlegx commented Feb 14, 2024

Can confirm problem!

@iaacosta
Copy link

Can also confirm the problem happens in Vue 3

This seems to work for me at the moment (thanks @tjk / @phlegx), you can also use create() but make sure the mixin is initialized before initializing the ActionCable plugin.

Haven't tried it in production yet, but if any confirmed related issues arise I'll be posting them here

mclintprojects added a commit that referenced this issue Aug 31, 2024
@mclintprojects
Copy link
Owner

Fixed in v3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants