diff options
| author | Christian Cleberg <[email protected]> | 2026-03-19 16:59:16 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-03-19 16:59:16 -0500 |
| commit | b82bbeeea48ad27832a355c2a41408559c411104 (patch) | |
| tree | 0af45101300c75970471573b09f878a1b3763b38 /Hutch/App | |
| parent | 9065ef6e92245a44390e336cc1ae515ae706cdd7 (diff) | |
| download | hutch-b82bbeeea48ad27832a355c2a41408559c411104.tar.gz hutch-b82bbeeea48ad27832a355c2a41408559c411104.tar.bz2 hutch-b82bbeeea48ad27832a355c2a41408559c411104.zip | |
v2.1: bundled polish and fixes
Diffstat (limited to 'Hutch/App')
| -rw-r--r-- | Hutch/App/RootView.swift | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/Hutch/App/RootView.swift b/Hutch/App/RootView.swift index 0885835..f615541 100644 --- a/Hutch/App/RootView.swift +++ b/Hutch/App/RootView.swift @@ -146,12 +146,10 @@ struct RootView: View { resolveRepositoryLink(owner: owner, repo: repo) case .build(let jobId): - // Reset the builds navigation and push the detail buildsPath = NavigationPath() appState.selectedTab = .builds - // Defer the push slightly so the tab switch takes effect - Task { @MainActor in - try? await Task.sleep(for: .milliseconds(100)) + Task { + await settleNavigationTransition() buildsPath.append(jobId) } @@ -165,26 +163,25 @@ struct RootView: View { case .repository(let repository): repoPath = NavigationPath() appState.selectedTab = .repositories - Task { @MainActor in - try? await Task.sleep(for: .milliseconds(100)) + Task { + await settleNavigationTransition() repoPath.append(repository) } case .tracker(let tracker): ticketsPath = NavigationPath() appState.selectedTab = .tickets - Task { @MainActor in - try? await Task.sleep(for: .milliseconds(100)) + Task { + await settleNavigationTransition() ticketsPath.append(tracker) } case .mailingList(let mailingList): morePath = NavigationPath() appState.selectedTab = .more - Task { @MainActor in - try? await Task.sleep(for: .milliseconds(100)) + Task { + await settleNavigationTransition() morePath.append(MoreRoute.lists) - try? await Task.sleep(for: .milliseconds(100)) morePath.append(MoreRoute.mailingList(mailingList)) } } @@ -198,7 +195,7 @@ struct RootView: View { let summary = try await appState.resolveRepository(owner: owner, name: repo) repoPath = NavigationPath() appState.selectedTab = .repositories - try? await Task.sleep(for: .milliseconds(100)) + await settleNavigationTransition() repoPath.append(summary) } catch { // Silently fail — the repo may not exist or be inaccessible @@ -214,9 +211,8 @@ struct RootView: View { let trackerSummary = try await appState.resolveTracker(owner: owner, name: tracker) ticketsPath = NavigationPath() appState.selectedTab = .tickets - try? await Task.sleep(for: .milliseconds(100)) + await settleNavigationTransition() ticketsPath.append(trackerSummary) - try? await Task.sleep(for: .milliseconds(100)) ticketsPath.append(TicketDeepLinkTarget( ownerUsername: String(trackerSummary.owner.canonicalName.dropFirst()), trackerName: trackerSummary.name, @@ -229,6 +225,12 @@ struct RootView: View { } } } + + @MainActor + private func settleNavigationTransition() async { + await Task.yield() + await Task.yield() + } } enum MoreDestination: Hashable { |
