Coder Social home page Coder Social logo

Controller over reflex attribute is ignore and reflex is always called with default StimulusReflexController about stimulus_reflex HOT 7 CLOSED

Laykou avatar Laykou commented on June 11, 2024
Controller over reflex attribute is ignore and reflex is always called with default StimulusReflexController

from stimulus_reflex.

Comments (7)

marcoroth avatar marcoroth commented on June 11, 2024 1

I need to double check, it might be related #636, but I think it's more related to an unhandled edge case with setting up the declarative reflex attributes.

from stimulus_reflex.

Laykou avatar Laykou commented on June 11, 2024

In our case the hotfix is creating a method in JS data-action="my-controller#myMethod" and call this.stimulate('Reflex#action', event.target) within it manually.

from stimulus_reflex.

Laykou avatar Laykou commented on June 11, 2024

@julianrubisch Is this still an open topic or was this issue somehow addressed/fixed in the latest changes in the past month?

I'd like to know if it's worth upgrading the lib or if we still have to use workaround via custom actions data-action + this.stimulate

from stimulus_reflex.

julianrubisch avatar julianrubisch commented on June 11, 2024

hasn't been addressed yet, sadly.

@marcoroth do we have to untie #636 ?

from stimulus_reflex.

Laykou avatar Laykou commented on June 11, 2024

Is there some new version/release I could try this on?

from stimulus_reflex.

marcoroth avatar marcoroth commented on June 11, 2024

Looks like I can't reproduce this on rc2.

But looking at your example you need to make sure to also include the event itself in your data-reflex attribute:

- data-reflex="Example#masticate"
+ data-reflex="click->Example#masticate"

So the following snippet:

<div data-controller="example">
  <a href="#" data-reflex="click->Example#masticate">Eat</a>
</div>

will transform into this as expected (this is on 3.5.0.rc2):

<div data-controller="example">
  <a href="#" data-reflex="click->Example#masticate" data-action="click->example#__perform">Eat</a>
</div>

Also make sure that StimulusReflex was registered in the example controller, otherwise it will default to the regular stimulus-reflex controller to make it work.

from stimulus_reflex.

marcoroth avatar marcoroth commented on June 11, 2024

This should be resolved with the release of v3.5.0.rc4. I'm going to close this issue, but please feel free to re-open if you are still seeing something unexpected!

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.