-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto-inject dependencies into components
By using dry-system's auto_inject feature, we can get rid of the boilerplate code that injects dependencies into components. We create a `SolidusAdmin::Import` constant that can be used to dynamically create a module that gets included into a component. This module will provide instance methods to fetch the declared dependencies from the component. We also register a top level `main_nav_items` dependency to avoid calling a private in nature `.within_namespace` method. [1] - https://dry-rb.org/gems/dry-system/1.0/dependency-auto-injection/
- Loading branch information
1 parent
8150c02
commit 5dbf45b
Showing
5 changed files
with
21 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
require "solidus_admin/container" | ||
|
||
module SolidusAdmin | ||
Import = Container.injector | ||
end |
This file contains 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