This commit is contained in:
Thomas Ricouard 2024-01-19 12:35:41 +01:00
parent f79117eff1
commit ebdd5b9feb
2 changed files with 14 additions and 3 deletions

View File

@ -40,7 +40,13 @@ public enum TimelineFilter: Hashable, Equatable, Identifiable {
case resume case resume
public var id: String { public var id: String {
title switch self {
case let .remoteLocal(server, filter):
return server + filter.rawValue
default:
return title
}
} }
public func hash(into hasher: inout Hasher) { public func hash(into hasher: inout Hasher) {

View File

@ -154,13 +154,18 @@ public struct TimelineView: View {
break break
} }
}) })
.onChange(of: timeline) { _, newValue in .onChange(of: timeline) { oldValue, newValue in
switch newValue { switch newValue {
case let .remoteLocal(server, _):
viewModel.client = Client(server: server)
default:
switch oldValue {
case let .remoteLocal(server, _): case let .remoteLocal(server, _):
viewModel.client = Client(server: server) viewModel.client = Client(server: server)
default: default:
viewModel.client = client viewModel.client = client
} }
}
viewModel.timeline = newValue viewModel.timeline = newValue
} }
.onChange(of: viewModel.timeline) { _, newValue in .onChange(of: viewModel.timeline) { _, newValue in