mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Channels caching
This commit is contained in:
@@ -133,7 +133,18 @@ struct ChannelVideosView: View {
|
||||
}
|
||||
#endif
|
||||
.onAppear {
|
||||
resource?.loadIfNeeded()
|
||||
if let channel,
|
||||
let cache = ChannelsCacheModel.shared.retrieve(channel.cacheKey),
|
||||
store.item.isNil
|
||||
{
|
||||
store.replace(cache)
|
||||
}
|
||||
|
||||
resource?.loadIfNeeded()?.onSuccess { response in
|
||||
if let channel: Channel = response.typedContent() {
|
||||
ChannelsCacheModel.shared.store(channel)
|
||||
}
|
||||
}
|
||||
}
|
||||
.onChange(of: contentType) { _ in
|
||||
resource?.load()
|
||||
|
Reference in New Issue
Block a user