Stimulus not autoloading controllers
Decided to give stimulus a try on a new app I am working on and immediately ran into issues. Up to this point this is a fresh rails 6.1 app and I have installed Hotwire-rails.
Just using the hello example controller that comes by default I get this error in the console - Failed to autoload controller: hello
.
What is weird to me is that if I remove the targets array and simply have
connect() {
console.log('hi')
}
I will get that output in the console. So Stimulus is "working" in a sense, but not the way it should be.
Turns out this is an issue in Safari, but not in Chrome and Firefox.
Seems like kind of a huge issue and so anti-pattern to the basecamp/DHH way of doing things. Maybe I am missing something though.
i have a controller named dropdown. and this is my code
import { Controller } from "@hotwired/stimulus"
// Connects to data-controller="dropdown"
export default class extends Controller {
connect() {
alert("hi")
console.log("Hello from Drowpdown")
}
}
i can't see any output in console
rails v = 7.0.2.2
ruby v = 3.0.0
any suggestions?