Pills performance improvements (#1891)

* big performance improvement for pills

* small overall performance improvement

* code improvements
This commit is contained in:
Mauro
2023-10-13 14:40:18 +02:00
committed by GitHub
parent f97a7c8cce
commit 8e03b89641
6 changed files with 50 additions and 58 deletions
@@ -925,3 +925,16 @@ private struct ReplyInfo {
let type: EventBasedMessageTimelineItemContentType
let isThread: Bool
}
private struct RoomContextKey: EnvironmentKey {
@MainActor
static let defaultValue = RoomScreenViewModel.mock.context
}
extension EnvironmentValues {
/// Used to access and inject and access the room context without observing it
var roomContext: RoomScreenViewModel.Context {
get { self[RoomContextKey.self] }
set { self[RoomContextKey.self] = newValue }
}
}
@@ -163,6 +163,7 @@ class TimelineTableViewController: UIViewController {
.id(id)
.frame(maxWidth: .infinity, alignment: .leading)
.environmentObject(coordinator.context) // Attempted fix at a crash in TimelineItemContextMenu
.environment(\.roomContext, coordinator.context)
}
.margins(.all, self.timelineStyle.rowInsets)
.minSize(height: 1)