Giter Club home page Giter Club logo

Comments (9)

bbugh avatar bbugh commented on July 29, 2024 1

If it helps, I also reported this issue and have easily reproducible steps in #153.

from stimulus_reflex.

 avatar commented on July 29, 2024 1

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.

hopsoft avatar hopsoft commented on July 29, 2024

Thanks for the bug report. This is interesting. What client side event is your reflex wired up to?

from stimulus_reflex.

 avatar commented on July 29, 2024

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.

hopsoft avatar hopsoft commented on July 29, 2024

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.

 avatar commented on July 29, 2024

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.

hopsoft avatar hopsoft commented on July 29, 2024

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.

patmisch avatar patmisch commented on July 29, 2024

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.

hopsoft avatar hopsoft commented on July 29, 2024

Sorry for any confusion. Please use 3.0.0 while waiting for the patch. 🙏

from stimulus_reflex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.