Introduce application.lazyLoadingControllers config#687
Open
marcoroth wants to merge 1 commit into
Open
Conversation
This configuration is used to indicate if the Stimulus application is lazy loading its Stimulus controllers or if the controllers are being eager loaded.
Member
|
Like where this is going, but would prefer to treat it as a complete solution. If that means pulling the loading strategies into Stimulus, let's do that. |
Member
Author
|
I'll have a look how that might look like if we'd want to move everything into Stimulus itself. |
|
I've given it a shot here: #690 :-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This configuration is used to indicate if the Stimulus application is lazy loading its Stimulus controllers or if the controllers are being eager loaded.
Ideally this configuration wouldn't be necessary in the first place, but since the logic for handling lazy/eager loading Stimulus controllers with Importmaps is handled in
stimulus-loading.jsinstimulus-railswe can't really control/check the current setting.This pull request allows the functions in
stimulus-loading.jsto setapplication.lazyLoadingControllers = trueso the actual Stimulus application knows the loading approach. With that we can control behavior like showing "unregistered controller warnings" based on this setting (see #413 and #653).Since Stimulus is autoloading controllers in the lazy loading mode we can't really know if/when we should show an unregistered controller warning since they are being fetched on-the-fly. Down the road we probably want to integrate the lazy loading approaches directly into
@hotwired/stimulusitself se we have more control over this behavior.Note: for now
application.lazyLoadingControllersis considered "private", we don't expect developers to set that config in their applications.