Skip to content

Commit

Permalink
Merge pull request #1810 from InsertKoinIO/fix/compose_scope_doc
Browse files Browse the repository at this point in the history
Add information about wrapping up around ClosedScopeException case
  • Loading branch information
arnaudgiuliani committed Mar 4, 2024
2 parents 765c311 + e1b50a7 commit ebafbc8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/reference/koin-compose/compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ fun App() {
}
```

:::info
:::note
Difference between `KoinAndroidContext` and `KoinContext`:
- `KoinAndroidContext` is looking into current Android app context for Koin instance
- `KoinContext` is looking into current GlobalContext for Koin instances
:::

:::info
If you get some `ClosedScopeException` from a Composable, either use `KoinContext` on your Composable or ensure to have proper Koin start configuration [with Android context](/docs/reference/koin-android/start.md#from-your-application-class)
:::

### Compose Preview with Koin

The `KoinApplication` function is also interesting to start dedicated context for preview. This can be also used to help with Compose preview:
Expand Down

0 comments on commit ebafbc8

Please sign in to comment.