mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 19:44:05 +00:00
Reuse previously build room summaries for diffs that contain invalidations
This commit is contained in:
committed by
Stefan Ceriu
parent
13decc668a
commit
eb691b0a51
@@ -177,8 +177,19 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
|
|||||||
case .filled(let roomId):
|
case .filled(let roomId):
|
||||||
return buildRoomSummaryForIdentifier(roomId, invalidated: false)
|
return buildRoomSummaryForIdentifier(roomId, invalidated: false)
|
||||||
case .invalidated(let roomId):
|
case .invalidated(let roomId):
|
||||||
|
guard let cachedRoom = rooms.first(where: { $0.id == roomId }) else {
|
||||||
return buildRoomSummaryForIdentifier(roomId, invalidated: true)
|
return buildRoomSummaryForIdentifier(roomId, invalidated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch cachedRoom {
|
||||||
|
case .empty:
|
||||||
|
return .empty
|
||||||
|
case .filled(let details):
|
||||||
|
return .invalidated(details: details)
|
||||||
|
case .invalidated:
|
||||||
|
return cachedRoom
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next cyclomatic_complexity function_body_length
|
// swiftlint:disable:next cyclomatic_complexity function_body_length
|
||||||
|
|||||||
Reference in New Issue
Block a user