hotwired / stimulus-rails

Use Stimulus in your Ruby on Rails app
https://stimulus.hotwired.dev
MIT License
638 stars 92 forks source link

Use stimulus router lookup table to decide if controller is registered #113

Closed ikanade closed 1 year ago

ikanade commented 1 year ago

Fixes issue https://github.com/hotwired/stimulus-rails/issues/111 where lazy loading will attempt to load the external stimulus controller even if it was registered manually.

Improves on the fix from https://github.com/hotwired/stimulus-rails/pull/97 where a new lookup table is created to check if a controller is registered or not. Stimulus already maintains this mapping here which we can use to determine if a controller was registered outside of stimulus-loading's scope and avoid re-registering it.