commit b21a2574eb93ebb04ce74c053049eb3640afaa58
parent 61175a392c0e9a71909f74e7f7687f784a68df1c
Author: Michael Camilleri <[email protected]>
Date: Thu, 11 Jun 2026 14:45:31 +0900
Cap the Diagnostics event list at the last 50 entries
The event buffer now spans a full day — tens of thousands of entries
after a co-solve — and rendering the whole thing in the Diagnostics
screen just buries the recent tail that an in-person glance is after.
This commit shows only the newest 50, with a footer noting the total
count and pointing at Share Full Log, which still exports the complete
history.
Co-Authored-By: Claude Fable 5 <[email protected]>
Diffstat:
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/Crossmate/Views/DiagnosticsView.swift b/Crossmate/Views/DiagnosticsView.swift
@@ -41,6 +41,11 @@ struct DiagnosticsView: View {
@State private var isSyncing = false
@State private var diagnosticShareFile: URL?
+ /// The on-screen list is a quick glance, not the archive — the buffer now
+ /// spans a full day (tens of thousands of entries during a co-solve), and
+ /// rendering it all just buries the tail. The shared file keeps everything.
+ private let visibleEventLimit = 50
+
var body: some View {
List {
Section("Status") {
@@ -86,12 +91,12 @@ struct DiagnosticsView: View {
.disabled(isSyncing)
}
- Section("Recent Events") {
+ Section {
if eventLog.entries.isEmpty {
Text("No events captured yet.")
.foregroundStyle(.secondary)
} else {
- ForEach(eventLog.entries.reversed()) { entry in
+ ForEach(eventLog.entries.suffix(visibleEventLimit).reversed()) { entry in
VStack(alignment: .leading, spacing: 4) {
Text(
"\(TimestampFormatter.string(from: entry.timestamp, in: .local)) [\(entry.level.uppercased())]"
@@ -106,6 +111,12 @@ struct DiagnosticsView: View {
.padding(.vertical, 2)
}
}
+ } header: {
+ Text("Recent Events")
+ } footer: {
+ if eventLog.entries.count > visibleEventLimit {
+ Text("Showing the last \(visibleEventLimit) of \(eventLog.entries.count) events. Share Full Log includes the complete history.")
+ }
}
}
.navigationTitle("Diagnostics Log")