Erik Huang


50 Experience
0 Lessons Completed
0 Questions Solved


I am using Rails 6 and recently upgraded from Ruby 3.0.1 to 3.1.2. Since the upgrade for some reason, my reflexes are no longer working properly when invoked from stimulus controllers, as shown in profile-form#addTag():


import { Controller } from '@hotwired/stimulus';
import StimulusReflex from 'stimulus_reflex';

export default class extends Controller {
  connect() {

  getControllerByIdentifier(identifier) {
    return this.application.controllers.find((controller) => {
      return controller.context.identifier === identifier;

  beforeReflex(element, reflex) {

  afterReflex(element, reflex) {


import ApplicationController from './application_controller';

export default class extends ApplicationController {
  static targets = ['form'];

  connect() {

  addTag(event) {
    this.stimulate("ProfileForm#add_tag", this.formTarget);

ActionCable seems to be working properly, and when I console log in the stimulus callbacks, I can verify beforeReflex is returning but not afterReflex. This is only happening when I pass a stimulus data target in to this.stimulate() so:

this.stimulate( behaves as expected but this.stimulate(this.formTarget) does not.

Anyone happen across this issue before? I'd be happy to provide more context if needed.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2023 GoRails, LLC. All rights reserved.