Skip to content

Commit

Permalink
Pass FragmentId to FeatureFactory. (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
Laimiux authored Sep 25, 2024
1 parent 3ddba2a commit 520ca1c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ abstract class FeatureFactory<in Dependencies, in Key : FragmentKey> {

inner class Params(
val dependencies: @UnsafeVariance Dependencies,
val fragmentId: FragmentId,
val key: @UnsafeVariance Key,
)

Expand All @@ -50,7 +51,7 @@ abstract class FeatureFactory<in Dependencies, in Key : FragmentKey> {
/**
* Initializes state observable and a view factory for a specific [key].
*/
fun initialize(dependencies: Dependencies, key: Key): Feature {
return Params(dependencies, key).initialize()
fun initialize(dependencies: Dependencies, fragmentId: FragmentId, key: Key): Feature {
return Params(dependencies, fragmentId, key).initialize()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ data class FragmentEnvironment(
dependencies: DependenciesT,
key: KeyT,
): Feature {
return factory.initialize(dependencies, key)
return factory.initialize(dependencies, fragmentId, key)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ internal class MappedFeatureFactory<Component, Dependencies, Key : FragmentKey>(
override fun Params.initialize(): Feature {
return delegate.initialize(
dependencies = toDependencies(dependencies),
fragmentId = fragmentId,
key = key,
)
}
Expand Down

0 comments on commit 520ca1c

Please sign in to comment.