You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(home): make ResolvedSection Equatable so unchanged Home reloads don't re-render every row #10
HomeViewModel.sections holds [ResolvedSection], and ResolvedSection is not Equatable. @Observable can't skip a no-change assignment, so every loadSections() (debounced watch-state refreshes, returning from the player) re-renders Home even when the server returns the same rows. HomeFeedRow takes the whole section plus fresh closures, so every row body re-runs too.
Add Equatable conformance (its members SectionItem and SectionCollectionCard are already Hashable, so it can be synthesized). Optionally guard the assignment with if new != sections.
Estimated effort: S
Source
Found in a SwiftUI best-practice review of main at 71a3beb (code reading only; not built or profiled). Line numbers and confirmation are in the triage comment.
ELI5
The home screen redraws everything even when nothing changed. Letting the app compare old and new rows lets it skip that work.
Verdict: Confirmed on main 71a3beb by reading the code (not profiled). ResolvedSection is not Equatable, so every assignment to HomeViewModel.sections notifies observers, even when the server sends the same rows. I did not measure how much rendering that costs.
What I checked
ResolvedSection is Codable, Identifiable only, and every stored property is already Equatable (strings, optionals, a [String: String]? and two arrays of Hashable models): Models.swift L613-L633. SectionItem and SectionCollectionCard use synthesized Hashable with no custom ==: L151, L450. So synthesized equality compares every field, including watch progress.
HomeViewModel is @Observable, and sections is a plain stored property: HomeViewModel.swift L3-L15. Each load replaces it unconditionally: L246-L251, and the cache hydrate does the same: L83-L85.
The @Observable macro in the current SDK generates a shouldNotifyObservers member that only skips equal values when the property's type is Equatable. A non-Equatable array always notifies.
Not a duplicate. I searched fork and upstream for "ResolvedSection", "Equatable", "Home re-render" and "Home refresh". Related: #48 (the tvOS feed deep-compares section items each body pass and proposes a revision counter instead; the two approaches should agree), #47 (per-row flag computation in HomeFeedRow), #5 (tvOS Home showing stale progress, a correctness problem, not this one). Redundancy check: no Equatable conformance or extension for ResolvedSection anywhere at head. No .out-of-scope/ directory.
Agent Brief
Category: enhancement
Summary: Make ResolvedSectionEquatable so reloading Home with unchanged rows doesn't notify observers.
Current behavior: Every Home load and cache hydrate assigns a fresh array of sections. Because the section type can't be compared, observation treats each assignment as a change and Home re-renders, even when nothing changed.
Desired behavior: Assigning a sections array equal to the current one sends no change notification. Any real difference, including a changed watch position, title, item order or collection card, still notifies and re-renders.
Key interfaces:
ResolvedSection: add synthesized Equatable conformance. Don't add a custom == that compares only IDs.
HomeViewModel.sections: no API change. An explicit inequality guard before assignment is optional.
Acceptance criteria:
ResolvedSection conforms to Equatable with field-by-field equality.
A unit test using observation tracking shows that assigning an equal sections array to HomeViewModel does not fire the change handler.
A unit test shows that a section differing only in one item's watch position does fire it.
Existing Home and section tests pass on iOS, tvOS and macOS.
Activity
Artic0din commentedon Nov 21, 2026
Triage
Verdict: Confirmed on main
71a3bebby reading the code (not profiled).ResolvedSectionis notEquatable, so every assignment toHomeViewModel.sectionsnotifies observers, even when the server sends the same rows. I did not measure how much rendering that costs.What I checked
ResolvedSectionisCodable, Identifiableonly, and every stored property is alreadyEquatable(strings, optionals, a[String: String]?and two arrays ofHashablemodels): Models.swift L613-L633.SectionItemandSectionCollectionCarduse synthesizedHashablewith no custom==: L151, L450. So synthesized equality compares every field, including watch progress.HomeViewModelis@Observable, andsectionsis a plain stored property: HomeViewModel.swift L3-L15. Each load replaces it unconditionally: L246-L251, and the cache hydrate does the same: L83-L85.@Observablemacro in the current SDK generates ashouldNotifyObserversmember that only skips equal values when the property's type isEquatable. A non-Equatablearray always notifies.HomeFeedRowis iOS and macOS only; tvOS has its own feed.Models.swiftand Home, so watch for conflicts.Duplicates
Not a duplicate. I searched fork and upstream for "ResolvedSection", "Equatable", "Home re-render" and "Home refresh". Related: #48 (the tvOS feed deep-compares section items each body pass and proposes a revision counter instead; the two approaches should agree), #47 (per-row flag computation in
HomeFeedRow), #5 (tvOS Home showing stale progress, a correctness problem, not this one). Redundancy check: noEquatableconformance or extension forResolvedSectionanywhere at head. No.out-of-scope/directory.Agent Brief
Category: enhancement
Summary: Make
ResolvedSectionEquatableso reloading Home with unchanged rows doesn't notify observers.Current behavior: Every Home load and cache hydrate assigns a fresh array of sections. Because the section type can't be compared, observation treats each assignment as a change and Home re-renders, even when nothing changed.
Desired behavior: Assigning a sections array equal to the current one sends no change notification. Any real difference, including a changed watch position, title, item order or collection card, still notifies and re-renders.
Key interfaces:
ResolvedSection: add synthesizedEquatableconformance. Don't add a custom==that compares only IDs.HomeViewModel.sections: no API change. An explicit inequality guard before assignment is optional.Acceptance criteria:
ResolvedSectionconforms toEquatablewith field-by-field equality.HomeViewModeldoes not fire the change handler.Out of scope:
HomeFeedRow.Triaged against main 71a3beb on 21 Nov 2026.