Me tab: authState read via unsafe cast, should be reactive StateFlow #41

Closed
opened 2026-06-22 20:10:22 +00:00 by starsetbyte · 0 comments
Owner

What

PeregrineNavHost.kt Me tab reads own DID via (authState as? AuthState.Authenticated)?.did — a one-shot cast in a composable, not a reactive flow. If authState changes after composition, the DID is stale.

Fix

Added ownDid: StateFlow<String?> to AppViewModel that maps from authState. PeregrineNavHost now uses appViewModel.ownDid.collectAsStateWithLifecycle() with a local val for smart-cast safety.

Fixed in PR #36.

## What `PeregrineNavHost.kt` Me tab reads own DID via `(authState as? AuthState.Authenticated)?.did` — a one-shot cast in a composable, not a reactive flow. If authState changes after composition, the DID is stale. ## Fix Added `ownDid: StateFlow<String?>` to `AppViewModel` that maps from `authState`. PeregrineNavHost now uses `appViewModel.ownDid.collectAsStateWithLifecycle()` with a local val for smart-cast safety. **Fixed in PR #36.**
starsetbyte 2026-06-22 20:10:22 +00:00
Sign in to join this conversation.
No description provided.