Digital PCT265 defect MVAPCT-272: Add throttle trigger to halt updates for first half second.
This commit is contained in:
parent
3a4322702c
commit
30ee30d1c7
@ -87,11 +87,12 @@ import Combine
|
||||
let updates = (updatedBatch, batchCount + 1)
|
||||
return updates
|
||||
}
|
||||
.prepend(((nil,nil,nil), 0)) // Trigger the throttler.
|
||||
// Delay allowing the previous model update to settle before triggering a re-render.
|
||||
.throttle(for: .seconds(0.5), scheduler: RunLoop.main, latest: true)
|
||||
.sink { [weak self] (pendingUpdates: PageUpdateBatch, batchCount: Int) in
|
||||
guard let self = self else { return }
|
||||
let (pageUpdates, pageModel, moduleUpdates) = pendingUpdates
|
||||
guard let self = self, batchCount > 0 else { return }
|
||||
if let pageUpdates, pageModel != nil {
|
||||
self.loadObject?.pageJSON = pageUpdates
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user