fix(memorylane): propagate snapshot-listener errors so the screen doesn't hang (F-OBS P3)
observeCapsules swallowed listener errors (return@), so on PERMISSION_DENIED the flow never emitted or closed and Memory Lane hung on its loading heart forever. Now close(err)s the flow -> the ViewModel's existing onFailure -> ERROR state with Retry. (Root cause that masked D-001.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
497e641a90
commit
ab2ff8dbc7
|
|
@ -67,7 +67,12 @@ class FirestoreCapsuleDataSource @Inject constructor(
|
|||
val reg = col(coupleId)
|
||||
.orderBy("createdAt", com.google.firebase.firestore.Query.Direction.DESCENDING)
|
||||
.addSnapshotListener { snap, err ->
|
||||
if (err != null || snap == null) return@addSnapshotListener
|
||||
// Propagate listener failures (e.g. PERMISSION_DENIED) by closing the flow so
|
||||
// the collector's error handling runs. Previously this swallowed the error
|
||||
// (`return@`), so the flow never emitted or closed and the Memory Lane screen
|
||||
// hung on its loading indicator forever (F-OBS).
|
||||
if (err != null) { close(err); return@addSnapshotListener }
|
||||
if (snap == null) return@addSnapshotListener
|
||||
trySend(snap.documents.mapNotNull { doc ->
|
||||
runCatching { mapToCapsule(doc, coupleId) }.getOrNull()
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue