Load inbox only on first appearance; refresh via pull-to-refresh; bump to 2.2
Build iOS App / Build .ipa and publish source (push) Successful in 22s
Build iOS App / Build .ipa and publish source (push) Successful in 22s
.task fires on every appearance, including popping back from a PR detail, so the landing page re-ran the full network refresh on each back navigation. Guard the initial load with didInitialLoad so the list loads once and then only refreshes when the user pulls down. Bump to 2.2.
This commit is contained in:
1 parent
2b929e65e9
commit
75f5f3bc64
2 files changed
+17
-5
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user