Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(ThreadListView): Stop observing AppStorage at cell level #1145

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Mail/Views/Thread List/ThreadListCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@ struct ThreadListCell: View {
@EnvironmentObject private var splitViewManager: SplitViewManager
@EnvironmentObject private var mainViewState: MainViewState

@AppStorage(UserDefaults.shared.key(.accentColor)) private var accentColor = DefaultPreferences.accentColor

let viewModel: ThreadListViewModel
@ObservedObject var multipleSelectionViewModel: ThreadListMultipleSelectionViewModel

let thread: Thread

let threadDensity: ThreadDensity
let accentColor: AccentColor

let isSelected: Bool
let isMultiSelected: Bool
Expand Down Expand Up @@ -128,6 +127,7 @@ struct ThreadListCell_Previews: PreviewProvider {
multipleSelectionViewModel: ThreadListMultipleSelectionViewModel(),
thread: PreviewHelper.sampleThread,
threadDensity: .large,
accentColor: .pink,
isSelected: false,
isMultiSelected: false,
flushAlert: .constant(nil)
Expand Down
1 change: 1 addition & 0 deletions Mail/Views/Thread List/ThreadListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ struct ThreadListView: View {
multipleSelectionViewModel: multipleSelectionViewModel,
thread: thread,
threadDensity: threadDensity,
accentColor: accentColor,
isSelected: viewModel.selectedThread?.uid == thread.uid,
isMultiSelected: multipleSelectionViewModel.selectedItems.contains(thread),
flushAlert: $flushAlert)
Expand Down
Loading