Skip to content

Commit f2b9334

Browse files
Fix controller registration with proper namespacing
- Pin controllers under "controllers" namespace for eagerLoadControllersFrom - Explicitly pin controllers/index.js and controllers/application.js - Add "to" parameter to ensure correct file paths - Controllers should now register with their proper names 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 67286c1 commit f2b9334

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

app/javascript/controllers/clipboard_controller.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import { Controller } from "@hotwired/stimulus"
22

33
export default class extends Controller {
44
static targets = ["content"]
5+
6+
connect() {
7+
console.log("Clipboard controller connected!")
8+
}
59

610
copy(event) {
711
const sourceId = event.currentTarget.dataset.clipboardSource

config/importmap.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
pin "@hotwired/stimulus", to: "stimulus.min.js"
55
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"
66

7-
# Pin all files from the engine's javascript directory
8-
pin_all_from File.expand_path("../app/javascript", __dir__), under: ".", to: "."
7+
# Pin controllers separately to ensure proper namespacing
8+
pin "controllers", to: "controllers/index.js"
9+
pin "controllers/application", to: "controllers/application.js"
10+
pin_all_from File.expand_path("../app/javascript/controllers", __dir__), under: "controllers", to: "controllers"
911

1012
# Pin marked for markdown parsing
1113
pin "marked", to: "https://cdn.jsdelivr.net/npm/[email protected]/+esm"

0 commit comments

Comments
 (0)