Comments (9)
If it helps, I also reported this issue and have easily reproducible steps in #153.
from stimulus_reflex.
3.1.2 fixed the problem for me and provided enough additional info for me to figure out what I did wrong, so THANKS.
For anyone else who hits this and runs across this issue: with 3.1.2, on page load I get StimulusReflex was unable to register the ActionCable consumer. Don't worry, everything should still work.
Things still didn't work when triggering the actual reflex from the UI, but now the console (properly) informs me
Error invoking action "input->stimulus-reflex#__perform"
The ActionCable connection is not open! `this.isActionCableConnectionOpen()` must return true before calling `this.stimulate()`
And that in turn finally led me to realize that the problem does indeed trace back to my own bad code. The issue in this case is that I have implemented authentication in ApplicationCable::Connection#connect
but this particular reflex appears on a page outside of the application's authentication context. So ActionCable is doing exactly what I told it to do and not connecting, and StimulusReflex is quite properly refusing to act without any way to talk to the server.
from stimulus_reflex.
Thanks for the bug report. This is interesting. What client side event is your reflex wired up to?
from stimulus_reflex.
It's a pretty direct clone of https://expo.stimulusreflex.com/demos/gravatar so it's on input
HAML source code:
.columns
.column
= f.input :email, hint: f.object.new_record? ? t('.email.hint') : nil, input_html: { data: { reflex: 'input->LibravatarReflex#perform' } }
.column
.span.image.is-64x64= image_tag(@libravatar_image_url || '')
from stimulus_reflex.
Does this error happen consistently or only some of the time? Also, what version of ActionCable are you using?
Note that I just deployed the expo site using StimulusReflex 3.1.0 and can't seem to replicate this error (locally or on the Heroku deployment).
http://expo.stimulusreflex.com/demos/gravatar
from stimulus_reflex.
It's consistently for me, ActionCable is at 6.0.2.2
Let me see if I can come up with a repro in a fresh project. If it doesn't repro on the Expo project it seems likely this is something squirrelly that I'm doing.
from stimulus_reflex.
OK. We need to be more defensive around this section of code (that's providing a non-essential bit of functionality). I'll work on a patch release today and try to ship it tomorrow. https://github.com/hopsoft/stimulus_reflex/blob/master/javascript/consumer.js#L36-L46
Thanks again.
from stimulus_reflex.
I've been pulling my hair out all day trying to figure this out as well. Assumed it was something I was doing wrong since this is my first time using ActionCable.
from stimulus_reflex.
Sorry for any confusion. Please use 3.0.0 while waiting for the patch. 🙏
from stimulus_reflex.
Related Issues (20)
- Controller over reflex attribute is ignore and reflex is always called with default StimulusReflexController HOT 7
- Broken Next Page Link on Welcome Page of Docs HOT 2
- HEAD and most of the latest releases are broken, references an undefined exception
- StimulusReflex is not compatible with the standalone ActionCable server HOT 9
- Wrong dataset getting from Docs example HOT 2
- NameError: undefined local variable or method `package_json' HOT 3
- Reflex not triggered when a Stimulus controller is also attached to a field HOT 4
- Form parse errors are not captured and reported back to front-end
- Drop Rails 5 and 6.0 support
- `solid_cache` seems to work as well as Rails cache store HOT 1
- Add full-stack tests
- Stimulus_reflex and esbuild error HOT 1
- OpenStruct no longer supported by json HOT 1
- Refactor away instances of OpenStruct
- NameError: uninitialized constant StimulusReflex::Installer::Thor when running rake tasks HOT 1
- Support `relative_url_root`
- Could not find generator 'stimulus_reflex:initializer'
- Unrecognized command "esbuild" (Rails::Command::UnrecognizedCommandError)
- Installer should work in CI (noninteractive) environment
- docs recommend hiredis gem along with incompatible redis version
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stimulus_reflex.