fix: defer content subscription until repo event is loaded
When a Git Repository screen is opened via deep-link (naddr) the addressable note exists but its event payload arrives later through EventFinder. RepositoryContentSubAssembler.updateFilter checks note.event and returns an empty filter when it isn't a GitRepositoryEvent yet — and since ComposeSubscriptionManager only re-invalidates on subscribe/unsubscribe, the now-stale empty filter persists indefinitely, leaving the Issues/Patches tabs permanently blank for cold-started repos. Gate the subscription composable on event presence so the underlying DisposableEffect fires fresh (running updateFilter again, this time with the populated event) only after the repo event has loaded.
This commit is contained in:
+11
-1
@@ -120,9 +120,19 @@ private fun GitRepositoryScreen(
|
||||
) {
|
||||
WatchLifecycleAndUpdateModel(issuesViewModel)
|
||||
WatchLifecycleAndUpdateModel(patchesViewModel)
|
||||
RepositoryFilterAssemblerSubscription(note, accountViewModel.dataSources().gitRepository)
|
||||
|
||||
val event by observeNoteEvent<GitRepositoryEvent>(note, accountViewModel)
|
||||
|
||||
// RepositoryContentSubAssembler.updateFilter reads note.event and bails out if it isn't
|
||||
// a GitRepositoryEvent yet. The compose subscription manager doesn't re-run updateFilter
|
||||
// when note.event later mutates, so subscribing before the event has arrived (cold-start
|
||||
// / deep-link case) leaves an empty filter forever. Gate the subscription composable on
|
||||
// event presence so it enters composition (and fires DisposableEffect → subscribe → fresh
|
||||
// updateFilter) only once the repo event is loaded.
|
||||
if (event != null) {
|
||||
RepositoryFilterAssemblerSubscription(note, accountViewModel.dataSources().gitRepository)
|
||||
}
|
||||
|
||||
val pagerState = rememberForeverPagerState(note.idHex + "GitRepoScreenPagerState") { 3 }
|
||||
|
||||
DisappearingScaffold(
|
||||
|
||||
Reference in New Issue
Block a user