From 0b84ecaf7ba0fb2cd3f3867da8dc732450b55b50 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Mon, 13 Apr 2026 13:35:03 -0500 Subject: perf: cache filtered collections and add equatable row views MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert filteredJobs, filteredPastes, and filteredTickets from computed properties to stored properties updated via didSet on their inputs. Each update function guards with an equality check before assigning, so @Observable skips the notification when the filtered result hasn't changed — preventing list re-renders on auto-refresh when no visible data has actually changed. Add Equatable conformance to BuildRowView, PasteRowView, TicketRowView, and SelectableTicketRow, and apply .equatable() at each ForEach call site. When a list does re-render, SwiftUI now skips body evaluation for rows whose model value is identical to the previous pass. Implements: https://todo.sr.ht/~ccleberg/hutch/57 --- Hutch/Views/Pastes/PasteListView.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Hutch/Views/Pastes/PasteListView.swift') diff --git a/Hutch/Views/Pastes/PasteListView.swift b/Hutch/Views/Pastes/PasteListView.swift index 0fdddd7..9363b08 100644 --- a/Hutch/Views/Pastes/PasteListView.swift +++ b/Hutch/Views/Pastes/PasteListView.swift @@ -73,6 +73,7 @@ struct PasteListView: View { ForEach(viewModel.filteredPastes) { paste in NavigationLink(value: paste) { PasteRowView(paste: paste) + .equatable() } .swipeActions(edge: .leading, allowsFullSwipe: true) { if swipeActionsEnabled { @@ -208,7 +209,7 @@ struct PasteListView: View { } } -private struct PasteRowView: View { +private struct PasteRowView: View, Equatable { let paste: Paste var body: some View { -- cgit v1.2.3