Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Avoids redundant sorting/mapping of full catalog collections during Home empty-state checks, and backs off hero timer work while the hero carousel is paused or scrolled below the fold.
Root Cause
HomeView.isEmptyreferencedrecentlyWatched.isEmptyandfavorites.isEmpty. Evaluating each computed property mapped and sorted the full set of watched/favorite movies, series, and channels across the active playlist just to check for presence.runAutoAdvance()inTVHomeScreenticked every 50 ms (20 Hz) regardless of whether the hero was below the fold (isPaused), and unconditionally assignedprogress = 0on every tick, causing continuous@Observablewrites and main thread churn when browsing lower rails.Changes
HomeDerivedContent.swift):HomeDerivedContent.hasRecentlyWatched(...)andHomeDerivedContent.hasFavorites(...)that early-exit on the first matching item with O(1) scans.homeRow(for:)(hasRecentlyWatched ? recentlyWatched : []andhasFavorites ? favorites : []), skipping full array generation when rails are empty.recentlyWatchedandfavoritesgeneration intoHomeDerivedContentto keepHomeView.swiftwithin size limits.TVHomeScreen.swift):progress = 0writes inTVHeroModelto only execute whenprogress != 0, preventing redundant notifications.runAutoAdvance(), increased sleep duration to 200 ms whilemodel.isPaused, reducing idle wakeups by 75% when scrolled below the fold..onDisappear { model.isPaused = true }and.onAppear { model.isPaused = zone != .expanded }.TVHeroModelin#if os(tvOS) || DEBUGso it can be verified via unit tests on simulator hosts.HomeIdleWorkTests.swift):TVHeroModelprogress ticking, auto-advance, dwell preservation, and paused state behavior.Validation
HomeIdleWorkTests: 8 / 8 tests passed.HomeLayoutSettingsTests,HomeDownloadsTests,MediaFavoritesTests): 30 / 30 tests passed.Scripts/lint-tool.sh swiftformatandswiftlint: 0 warnings, 0 violations.