Hoping someone can help me this. I have a Stimulus (2.0) controller that updates the database on a focusout event (see simplified version below). I’ve been having problems with this since upgrading to Rails 6.1. If I use config.load_defaults 6.0
in my application.rb file, it performs as expected, but when I switch to config.load_defaults 6.1
it no longer works (though I don’t have any issue with database updates via the Rails controllers). The event listener is still triggering as expected, but it doesn’t seem like Rails.fire is doing anything.
This may be strictly a Rails issue but I was hoping someone here might have an idea what’s causing it. I’m not really sure how to go about debugging this.
import { Controller } from "stimulus"
import Rails from "@rails/ujs";
export default class extends Controller {
static targets = ["title", "chapterForm"]
connect() {
let title = this.titleTarget;
let chapterForm = this.chapterFormTarget;
title.addEventListener('focusout', () => {
Rails.fire(chapterForm, 'submit')
})
}
}