Skip to content

Commit 3eac685

Browse files
authored
Merge branch 'feat/sentry-nav-effect-lifecycle' into feat/part-2-sentry-nav-effect-lifecycle
2 parents d4b69f1 + f3025c6 commit 3eac685

2 files changed

Lines changed: 9 additions & 14 deletions

File tree

‎sentry-android-navigation3/build.gradle.kts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ dependencies {
6262
implementation(projects.sentry)
6363

6464
compileOnly(libs.androidx.compose.runtime)
65-
// Provides lifecycle types used to coordinate overlapping navigation roots. Hosts get it at
66-
// runtime through Compose UI 1.7+ and navigation3-ui, both of which depend on it.
6765
compileOnly(libs.androidx.lifecycle.runtime.compose)
6866

6967
testImplementation(libs.androidx.compose.ui.test.junit4)

‎sentry-android-navigation3/src/main/kotlin/io/sentry/compose/navigation3/lifecycle/NavLeaseCoordinator.kt‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,13 @@ import io.sentry.SpanStatus
1818
*
1919
* **Exception semantics**
2020
*
21-
* Every method in this class with an `IScope` parameter can throw arbitrary exceptions due to:
21+
* Methods in this class with an `IScope` parameter can throw arbitrary exceptions†, which propagate
22+
* to the caller. This class restores its own bookkeeping first, so the coordinator remains usable
23+
* if the exception is caught.
2224
*
23-
* 1. the [onPublishData][registerCandidate] and [onClearPublishedData][registerCandidate] callbacks
24-
* supplied at registration;
25-
* 2. the `IScope` the method is handed, whose mutators notify every observer registered through
26-
* `SentryOptions.addScopeObserver` – including the host app's – in an unguarded loop; and
27-
* 3. `finish()` on a retained nav transaction, which may run the host app's event processors.
28-
*
29-
* This class restores its own bookkeeping before the exception leaves, so the coordinator remains
30-
* usable.
25+
* † E.g., `IScope` can throw arbitrary exceptions when scope mutators notify registered observers –
26+
* including the host app – in an unguarded loop, or when `finish()` is called on a retained nav
27+
* transaction, which can trigger the host app's event processors.
3128
*
3229
* **Thread safety**
3330
*
@@ -56,8 +53,8 @@ internal class NavLeaseCoordinator {
5653
private var resumeOrder: Long = 0
5754

5855
/**
59-
* Registers [owner] as a candidate for the nav lease. No-ops if `owner` is already registered or
60-
* [lifecycleState] is [destroyed][Lifecycle.State.DESTROYED].
56+
* Registers [owner] as a candidate for the nav lease. No-ops if `owner` instance is already
57+
* registered or [lifecycleState] is [destroyed][Lifecycle.State.DESTROYED].
6158
*
6259
* [onPublishData] publishes `owner`'s staged nav data to the given scope when `owner` acquires
6360
* the lease. [onClearPublishedData] clears `owner`'s published nav data from the given scope when
@@ -164,7 +161,7 @@ internal class NavLeaseCoordinator {
164161

165162
/**
166163
* Stops tracking [owner] (e.g., because it was destroyed or its effect left the composition).
167-
* No-ops if `owner` isn't registered.
164+
* No-ops if `owner` instance isn't registered.
168165
*
169166
* Finishes and unbinds `owner`'s nav transaction, and clears its published nav data if that data
170167
* is the most recently published. If `owner` holds the lease, hands it to the eligible candidate

0 commit comments

Comments
 (0)