mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-02-17 02:05:13 +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()
|
@StateObject private var viewModel = TimelineViewModel()
|
||||||
|
|
||||||
@State private var scrollProxy: ScrollViewProxy?
|
@State private var scrollProxy: ScrollViewProxy?
|
||||||
|
@State private var wasBackgrounded: Bool = false
|
||||||
|
|
||||||
@Binding var timeline: TimelineFilter
|
@Binding var timeline: TimelineFilter
|
||||||
@Binding var scrollToTopSignal: Int
|
@Binding var scrollToTopSignal: Int
|
||||||
|
@ -99,9 +100,15 @@ public struct TimelineView: View {
|
||||||
.onChange(of: scenePhase, perform: { scenePhase in
|
.onChange(of: scenePhase, perform: { scenePhase in
|
||||||
switch scenePhase {
|
switch scenePhase {
|
||||||
case .active:
|
case .active:
|
||||||
Task {
|
if wasBackgrounded {
|
||||||
await viewModel.fetchStatuses(userIntent: false)
|
wasBackgrounded = false
|
||||||
|
Task {
|
||||||
|
await viewModel.fetchStatuses(userIntent: false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
case .background:
|
||||||
|
wasBackgrounded = true
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue