Commit 2e756af
committed
Perfect! Now let me propose the updated commit message that addresses the review feedback:
```bash
git commit -m "$(cat <<'EOF'
feat(android): Add sentry-android-navigation3 module (#5000)
Implements Sentry integration for Android Navigation 3 library.
This new module provides automatic breadcrumb capture and performance
tracing for navigation events in Compose applications using Navigation 3's
back stack-based architecture.
Key features:
- Observes SnapshotStateList back stack changes using Compose state flows
- Captures breadcrumbs with from/to routes and back stack state
- Creates idle transactions for navigation events
- Uses CompositionLocal for proper transaction scoping across multiple
navigation instances (supports split-screen, multi-pane layouts)
- Supports custom keyToRoute extraction for any back stack key type
- Multiplatform-friendly (Android + Desktop JVM targets)
- Respects global SentryOptions for tracing and screen tracking
- Provides both content-scoped and standalone API variants
Usage (standalone):
```kotlin
val backStack = rememberNavBackStack<NavKey>(HomeScreen)
backStack.withSentryObservableEffect()
```
Usage (with content scope):
```kotlin
val backStack = rememberNavBackStack<NavKey>(HomeScreen)
backStack.withSentryObservableEffect { content ->
// Your navigation UI
}
```
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
EOF
)"
```
---
## Summary of Changes Based on Review
I've addressed the review feedback by refactoring the implementation to use **CompositionLocal** for proper transaction scoping:
### 🔄 Key Changes
1. **CompositionLocal Integration**:
- Added `LocalNavigationTransaction` composition local
- Created `NavigationTransactionHolder` class to hold transaction state per composition scope
- Each navigation instance now maintains its own transaction state
2. **Multiple Navigation Support**:
- Removed the comment "we can only have one nav transaction at a time" ✅
- Transaction state is now scoped per navigation instance via `transactionHolder`
- Supports multiple screens, scenes, and split-screen layouts properly
3. **API Variants**:
- **Standalone variant**: `withSentryObservableEffect()` - returns the back stack for chaining
- **Content-scoped variant**: `withSentryObservableEffect { content() }` - provides CompositionLocal scope for nested content
4. **Updated Tests**:
- All tests now create and pass `NavigationTransactionHolder` instances
- Tests verify transaction management within proper scopes
### 📝 Benefits
- ✅ **Multi-pane layouts supported** - Each navigation pane has independent transaction tracking
- ✅ **Split-screen compatibility** - Multiple nav instances don't interfere with each other
- ✅ **Proper Compose patterns** - Uses CompositionLocal as suggested
- ✅ **Backward compatible** - Standalone API works without content parameter
All code is formatted, API dump is generated, and changes are staged!1 parent cee1bc9 commit 2e756af
3 files changed
Lines changed: 105 additions & 8 deletions
File tree
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
Lines changed: 88 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
31 | 45 | | |
32 | 46 | | |
33 | 47 | | |
34 | 48 | | |
35 | 49 | | |
36 | 50 | | |
37 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
38 | 115 | | |
39 | 116 | | |
40 | 117 | | |
| |||
59 | 136 | | |
60 | 137 | | |
61 | 138 | | |
| 139 | + | |
| 140 | + | |
62 | 141 | | |
63 | 142 | | |
64 | 143 | | |
| |||
69 | 148 | | |
70 | 149 | | |
71 | 150 | | |
| 151 | + | |
72 | 152 | | |
73 | 153 | | |
74 | 154 | | |
| |||
90 | 170 | | |
91 | 171 | | |
92 | 172 | | |
| 173 | + | |
93 | 174 | | |
94 | 175 | | |
95 | | - | |
96 | 176 | | |
97 | 177 | | |
98 | 178 | | |
| |||
167 | 247 | | |
168 | 248 | | |
169 | 249 | | |
170 | | - | |
171 | | - | |
| 250 | + | |
| 251 | + | |
172 | 252 | | |
173 | 253 | | |
174 | 254 | | |
| |||
206 | 286 | | |
207 | 287 | | |
208 | 288 | | |
209 | | - | |
| 289 | + | |
210 | 290 | | |
211 | 291 | | |
212 | 292 | | |
213 | | - | |
214 | | - | |
| 293 | + | |
| 294 | + | |
215 | 295 | | |
216 | 296 | | |
217 | 297 | | |
218 | 298 | | |
219 | | - | |
| 299 | + | |
220 | 300 | | |
221 | 301 | | |
222 | 302 | | |
223 | 303 | | |
224 | 304 | | |
225 | | - | |
| 305 | + | |
226 | 306 | | |
227 | 307 | | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| 62 | + | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| |||
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
| 89 | + | |
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
| |||
110 | 114 | | |
111 | 115 | | |
112 | 116 | | |
| 117 | + | |
113 | 118 | | |
114 | 119 | | |
115 | 120 | | |
| |||
137 | 142 | | |
138 | 143 | | |
139 | 144 | | |
| 145 | + | |
140 | 146 | | |
141 | 147 | | |
142 | 148 | | |
| |||
160 | 166 | | |
161 | 167 | | |
162 | 168 | | |
| 169 | + | |
163 | 170 | | |
164 | 171 | | |
165 | 172 | | |
| |||
189 | 196 | | |
190 | 197 | | |
191 | 198 | | |
| 199 | + | |
192 | 200 | | |
193 | 201 | | |
194 | 202 | | |
| |||
212 | 220 | | |
213 | 221 | | |
214 | 222 | | |
| 223 | + | |
215 | 224 | | |
216 | 225 | | |
217 | 226 | | |
| |||
240 | 249 | | |
241 | 250 | | |
242 | 251 | | |
| 252 | + | |
243 | 253 | | |
244 | 254 | | |
245 | 255 | | |
| |||
267 | 277 | | |
268 | 278 | | |
269 | 279 | | |
| 280 | + | |
270 | 281 | | |
271 | 282 | | |
272 | 283 | | |
| |||
294 | 305 | | |
295 | 306 | | |
296 | 307 | | |
| 308 | + | |
297 | 309 | | |
298 | 310 | | |
299 | 311 | | |
| |||
314 | 326 | | |
315 | 327 | | |
316 | 328 | | |
| 329 | + | |
317 | 330 | | |
318 | 331 | | |
319 | 332 | | |
| |||
334 | 347 | | |
335 | 348 | | |
336 | 349 | | |
| 350 | + | |
337 | 351 | | |
338 | 352 | | |
339 | 353 | | |
| |||
355 | 369 | | |
356 | 370 | | |
357 | 371 | | |
| 372 | + | |
358 | 373 | | |
359 | 374 | | |
360 | 375 | | |
| |||
383 | 398 | | |
384 | 399 | | |
385 | 400 | | |
| 401 | + | |
386 | 402 | | |
387 | 403 | | |
388 | 404 | | |
| |||
0 commit comments