Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ struct MoviesScreen: View {
@WatchState(SearchQueryAtom())
var searchQuery

@ViewContext
var context

@State
var isShowingSearchScreen = false

Expand Down Expand Up @@ -45,9 +42,12 @@ struct MoviesScreen: View {
}

if let last = pages.last, last.hasNextPage {
ProgressRow().task {
await loader.loadNext()
}
ProgressRow()
// NB: Since ProgressView placed in the List will not redisplay its indicator once it's hidden, here adds a random ID so that it's always regenerated.
.id(UUID())
.task {
await loader.loadNext()
}
}
}
}
Expand All @@ -70,10 +70,7 @@ struct MoviesScreen: View {
await loader.refresh()
}
.refreshable {
// NB: Implicitly capturing `self` causes memory leak with `refreshable`,
// and also capturing `loader` makes refresh doesn't work, so here reads
// `MovieLoader` via context.
await context.read(MovieLoaderAtom()).refresh()
await loader.refresh()
}
.background {
NavigationLink(
Expand Down