diff --git a/GiteaPR.xcodeproj/project.pbxproj b/GiteaPR.xcodeproj/project.pbxproj index fbf6752..3e2f932 100644 --- a/GiteaPR.xcodeproj/project.pbxproj +++ b/GiteaPR.xcodeproj/project.pbxproj @@ -187,7 +187,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = ""; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_CFBundleDisplayName = "GiteaPR"; @@ -197,7 +197,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.1; + MARKETING_VERSION = 2.2; PRODUCT_BUNDLE_IDENTIFIER = com.bueso.giteapr; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -211,7 +211,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 12; + CURRENT_PROJECT_VERSION = 13; DEVELOPMENT_TEAM = ""; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_CFBundleDisplayName = "GiteaPR"; @@ -221,7 +221,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.1; + MARKETING_VERSION = 2.2; PRODUCT_BUNDLE_IDENTIFIER = com.bueso.giteapr; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; diff --git a/GiteaPR/Views/InboxView.swift b/GiteaPR/Views/InboxView.swift index 28765bf..02e1892 100644 --- a/GiteaPR/Views/InboxView.swift +++ b/GiteaPR/Views/InboxView.swift @@ -3,6 +3,11 @@ import SwiftUI struct InboxView: View { @StateObject private var vm = InboxViewModel() @State private var showSettings = false + // Load the inbox only on first appearance. `.task` fires on every + // appearance (including popping back from a PR detail), so without this + // guard the landing page re-runs the full network refresh on each back + // navigation. After the first load, refresh only via pull-to-refresh. + @State private var didInitialLoad = false var body: some View { NavigationStack { @@ -39,7 +44,14 @@ struct InboxView: View { .navigationDestination(for: PRRow.self) { row in PRDetailView(repo: row.repo, prNumber: row.pr.number) } - .task { await vm.load() } + .task { + // Load only on first appearance; subsequent appearances (e.g. + // popping back from a PR) reuse the cached list and only + // refresh when the user pulls down. + guard !didInitialLoad else { return } + didInitialLoad = true + await vm.load() + } .overlay { // Only show a spinner when there's nothing cached to display // yet; with a cache the list renders instantly and refreshes