github InsertKoinIO/koin 4.3.0-Beta1
Koin 4.3.0-Beta1

pre-release4 hours ago

First beta of the 4.3 line: a faster Koin core with no public API change, plus fixes for Ktor request scopes and Compiler Plugin ViewModels. Two behavior changes are flagged below.

⚠️ This is a beta, not a stable release: more 4.3 features are coming in the next betas, and new APIs may still change before 4.3.0. Stay on 4.2.2 for production. Please try it on your project and tell us what you see, especially under load or on Ktor.

Improvements

  • Faster resolution and registration in koin-core: no debug strings built when logging is off, and no index key rebuilt on repeat lookups. On the JVM:

    • Warm get(): 157 ns / 587 B per call, now 26 ns / 56 B.
    • Registering 3,600 definitions: 927 µs, now 269 µs.
    • Scope cascade resolution: 1,510 ns, now 731 ns.

    Resolution results are the same as 4.2. Android devices are not measured yet.

Bug Fixes

  • Ktor request scope closed for failed and cancelled calls (#2463, #2472): the scope was closed only when a response was sent. Cancelled calls (SSE closed, client gone), streams failing mid-body and failing response hooks kept the scope and its ApplicationCall alive until the server ran out of memory. The scope now closes at the end of every call; error pages and later response hooks still see it open.

    ⚠️ Behavior change: with HttpRequestLifecycle(cancelCallOnClose = true) and a WebSocket session, the request scope now closes on cancellation, before the session handler's finally. It was never closed before.

  • Ktor auto-reload no longer closes the new Koin (#2461, #2468): with Ktor 3.5, the old application's stop event closed the new application's Koin.

  • ParametersHolder.set accepts null (#2476), like parametersOf.

  • Compiler Plugin ViewModels no longer collide across modules (#2474): every plugin ViewModel was bound to ViewModel, so ViewModels in two or more modules failed at start under strictOverride(), or logged override warnings. They're now registered under their own type only, like viewModel { }.

    ⚠️ Behavior change: get<ViewModel>() and getAll<ViewModel>() no longer return Compiler Plugin ViewModels. Resolve a ViewModel by its own type.

    ViewModels extending a shared abstract class or interface still collide on that supertype: use @KoinViewModel(binds = []) until Koin Compiler Plugin 1.3.0.

Thanks 🙏

Your feedback is welcome!

Don't miss a new koin release

NewReleases is sending notifications on new releases.