Skip to content

Commit

Permalink
work around circular koin dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
jillesvangurp committed Sep 24, 2023
1 parent b7524de commit cd01302
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/jsMain/kotlin/examples/quotesearch/quotesearch.kt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ fun List<MovieQuote>.searchPlugin(nice: Boolean = true): SearchPlugin {
}

class MovieQuotesStore : RootStore<List<MovieQuote>>(listOf()) {
val activeSearchPluginConfigurationStore = koin.get<ActiveSearchPluginConfigurationStore>()
// use inject here to dodge circular dependency
val activeSearchPluginConfigurationStore by koin.inject<ActiveSearchPluginConfigurationStore>()

fun searchClient(): SearchClient {
val config = activeSearchPluginConfigurationStore.current
Expand Down
11 changes: 4 additions & 7 deletions src/jsMain/kotlin/searchpluginconfig/searchpluginconfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,22 @@ import com.jilesvangurp.rankquest.core.DEFAULT_JSON
import com.jilesvangurp.rankquest.core.DEFAULT_PRETTY_JSON
import com.jilesvangurp.rankquest.core.pluginconfiguration.*
import com.jilesvangurp.rankquest.core.plugins.BuiltinPlugins
import com.jilesvangurp.rankquest.core.plugins.PluginFactoryRegistry
import components.*
import dev.fritz2.core.*
import dev.fritz2.core.RenderContext
import dev.fritz2.core.Store
import dev.fritz2.core.disabled
import dev.fritz2.core.storeOf
import dev.fritz2.remote.http
import examples.quotesearch.MovieQuotesStore
import examples.quotesearch.movieQuotesNgramsSearchPluginConfig
import examples.quotesearch.movieQuotesSearchPluginConfig
import io.ktor.client.*
import io.ktor.client.engine.js.*
import io.ktor.client.plugins.logging.*
import koin
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.map
import kotlinx.serialization.encodeToString
import org.koin.core.module.dsl.singleOf
import org.koin.core.qualifier.named
import org.koin.dsl.module
import org.w3c.dom.HTMLDivElement

val configurationModule = module {
singleOf(::PluginConfigurationsStore)
Expand Down

0 comments on commit cd01302

Please sign in to comment.