Skip to content

Conversation

@arkivanov
Copy link
Owner

@arkivanov arkivanov commented Dec 14, 2025

Summary by CodeRabbit

  • New Features

    • DecomposeSettings gains a configurable onDecomposeError callback so callers can customize how decomposition errors are handled (defaults to the previous behavior).
  • Deprecations

    • Legacy top-level error handler API is deprecated — migrate to DecomposeSettings.onDecomposeError for configuration.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 14, 2025

Walkthrough

Adds a new onDecomposeError callback property to DecomposeSettings (with default ::printError), updates its constructor/copy/component signatures across platform APIs, and deprecates the legacy top-level onDecomposeError in favor of the settings-based property that delegates to DecomposeSettings.

Changes

Cohort / File(s) Summary
API signatures (platforms)
decompose/api/android/decompose.api, decompose/api/decompose.klib.api, decompose/api/jvm/decompose.api
Constructor and synthetic constructor signatures updated to include a Function1<Exception, Unit> parameter; copy(...) signatures and copy$default synthetic functions updated; added component3() and getOnDecomposeError() accessors.
Core implementation
decompose/src/commonMain/kotlin/com/arkivanov/decompose/DecomposeSettings.kt
Added public property val onDecomposeError: (Exception) -> Unit = ::printError; updated data class constructor, copy, and component generation to include the new property; added import and KDoc update.
Legacy API deprecation
decompose/src/commonMain/kotlin/com/arkivanov/decompose/errorhandler/ErrorHandlers.kt
Replaced top-level onDecomposeError variable with a deprecated property that delegates to DecomposeSettings.settings.onDecomposeError (getter returns current setting; setter updates via DecomposeSettings.update { it.copy(onDecomposeError = value) }).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify platform API files (Android, KLIB, JVM) have consistent signatures and synthetic constructor ordering.
  • Confirm default ::printError import and behavior are correct in DecomposeSettings.
  • Ensure deprecated ErrorHandlers.onDecomposeError getter/setter correctly delegate and the deprecation message is accurate.
  • Check data-class-generated methods (component3, copy, copy$default) compile and match new parameter ordering.

Possibly related PRs

Poem

🐰 I tacked a little handler where errors may creep,
Now Decompose listens while I softly sleep,
The old path still bows, but points to the new,
A hop, a fix, a rabbit’s cheerful view! 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding onDecomposeError to DecomposeSettings and deprecating the old onDecomposeError variable, which aligns with the core modifications across all affected files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch onDecomposeError

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3f1201f and da40668.

📒 Files selected for processing (5)
  • decompose/api/android/decompose.api (1 hunks)
  • decompose/api/decompose.klib.api (1 hunks)
  • decompose/api/jvm/decompose.api (1 hunks)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/DecomposeSettings.kt (2 hunks)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/errorhandler/ErrorHandlers.kt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • decompose/api/android/decompose.api
  • decompose/api/jvm/decompose.api
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-11-09T18:14:31.048Z
Learnt from: arkivanov
Repo: arkivanov/Decompose PR: 954
File: decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/children/ChildrenNavigator.kt:38-44
Timestamp: 2025-11-09T18:14:31.048Z
Learning: The Child.key property in Decompose is marked with ExperimentalDecomposeApi, so changes to its runtime value (e.g., from configuration to ItemKey) are acceptable breaking changes within the experimental API surface.

Applied to files:

  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/DecomposeSettings.kt
📚 Learning: 2025-05-28T22:32:21.630Z
Learnt from: arkivanov
Repo: arkivanov/Decompose PR: 880
File: docs/extensions/compose.md:429-431
Timestamp: 2025-05-28T22:32:21.630Z
Learning: In Decompose documentation, the correct import path for `subscribeAsState` in the Child Items navigation example is `com.arkivanov.decompose.extensions.compose.subscribeAsState`, not the jetbrains-specific variant. The import paths vary depending on the specific compose variant being used (general compose vs jetbrains/multiplatform compose).

Applied to files:

  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/DecomposeSettings.kt
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build on macOS
  • GitHub Check: Build on Linux
🔇 Additional comments (4)
decompose/src/commonMain/kotlin/com/arkivanov/decompose/DecomposeSettings.kt (2)

3-3: LGTM!

The import is necessary for the default parameter value and is correctly placed.


14-19: LGTM! Well-designed error handling configuration.

The new onDecomposeError parameter integrates cleanly into DecomposeSettings with a sensible default value (::printError), and the KDoc clearly explains its purpose. This provides a centralized, type-safe way to configure error handling across the library.

decompose/src/commonMain/kotlin/com/arkivanov/decompose/errorhandler/ErrorHandlers.kt (1)

3-13: LGTM! Excellent deprecation strategy.

The deprecation provides a clear migration path to DecomposeSettings#onDecomposeError, and the delegation maintains backward compatibility while centralizing error handling configuration. The getter and setter properly delegate to the settings, with the setter using the atomic update method.

decompose/api/decompose.klib.api (1)

486-498: LGTM! API surface correctly reflects source changes.

The klib API dump properly reflects the addition of the onDecomposeError parameter to DecomposeSettings, including the updated constructor signature (line 486), the new property with getter (lines 492-493), the new component3() method (line 497), and the updated copy method signature (line 498).


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
decompose/src/commonMain/kotlin/com/arkivanov/decompose/errorhandler/ErrorHandlers.kt (1)

8-13: Consider adding replaceWith = ReplaceWith(...) to the deprecation to ease migration.
Right now it’s message-only; a ReplaceWith("DecomposeSettings.settings = DecomposeSettings.settings.copy(onDecomposeError = value)") (or whatever preferred) would make IDE refactors smoother.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b6a767 and 3f1201f.

📒 Files selected for processing (5)
  • decompose/api/android/decompose.api (1 hunks)
  • decompose/api/decompose.klib.api (1 hunks)
  • decompose/api/jvm/decompose.api (1 hunks)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/DecomposeSettings.kt (2 hunks)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/errorhandler/ErrorHandlers.kt (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build on macOS
  • GitHub Check: Build on Linux
🔇 Additional comments (4)
decompose/src/commonMain/kotlin/com/arkivanov/decompose/DecomposeSettings.kt (1)

14-20: Nice defaulting of onDecomposeError to ::printError.
KDoc + sensible default makes the new hook easy to adopt without behavior changes for existing users.

decompose/api/android/decompose.api (1)

74-85: API dump updates look consistent with the new onDecomposeError property.
Please double-check these are produced by the project’s API/ABI tooling (not hand-edited) and that downstream compatibility expectations are met.

decompose/api/decompose.klib.api (1)

486-498: KLib ABI dump changes are consistent with adding onDecomposeError, but this is an ABI change for KMP consumers.
Please confirm the project’s compatibility/versioning expectations for KLib consumers are satisfied.

decompose/api/jvm/decompose.api (1)

74-85: JVM API dump changes look correct; verify JVM binary-compat expectations.
If you aim to support already-compiled clients, consider restoring a (Boolean, Boolean) overload (e.g., secondary ctor) or clearly treating this as a breaking change in the release/versioning.

@arkivanov arkivanov merged commit 2d39ef3 into master Dec 15, 2025
3 checks passed
@arkivanov arkivanov deleted the onDecomposeError branch December 15, 2025 22:58
@arkivanov arkivanov changed the title Added DecomposeSettings#onDecomposeError, deprecated onDecomposeError Added DecomposeSettings#onDecomposeError setting, deprecated onDecomposeError callback Dec 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants