mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-23 00:40:59 +00:00
Fix multiple timeline refresh on launch close #555
This commit is contained in:
parent
22af2db36c
commit
c88ef750f0
1 changed files with 9 additions and 2 deletions
|
@ -21,6 +21,7 @@ public struct TimelineView: View {
|
|||
@StateObject private var viewModel = TimelineViewModel()
|
||||
|
||||
@State private var scrollProxy: ScrollViewProxy?
|
||||
@State private var wasBackgrounded: Bool = false
|
||||
|
||||
@Binding var timeline: TimelineFilter
|
||||
@Binding var scrollToTopSignal: Int
|
||||
|
@ -99,9 +100,15 @@ public struct TimelineView: View {
|
|||
.onChange(of: scenePhase, perform: { scenePhase in
|
||||
switch scenePhase {
|
||||
case .active:
|
||||
if wasBackgrounded {
|
||||
wasBackgrounded = false
|
||||
Task {
|
||||
await viewModel.fetchStatuses(userIntent: false)
|
||||
}
|
||||
}
|
||||
case .background:
|
||||
wasBackgrounded = true
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue