git.iko.soy/parseable-macos
on master help sign in
Clear logs when switching datasets (#5)

Query results and live tail entries from the previous stream persisted when selecting a different stream, showing stale data. Now both views clear their log state immediately on stream switch. https://claude.ai/code/session_01TnjKbw2J9dacZvyv6RU2q2 Co-authored-by: Claude <noreply@anthropic.com>

commitedca1ae118ad31cfcc8ddfcf72a0010749efd4d8 authoriko <mail@iko.soy> dateSun 15 Feb 2026, 12:13 (8 months ago) parent9fee70b
3 files changed+12
ParseableViewer/ViewModels/QueryViewModel.swift+10 ParseableViewer/Views/LiveTailView.swift+1 ParseableViewer/Views/QueryView.swift+1
ParseableViewer/ViewModels/QueryViewModel.swift+10
@@ -274,6 +274,16 @@ final class QueryViewModel {
274274 return value
275275 }
276276
277+ func clearResults() {
278+ results = []
279+ columns = []
280+ resultCount = 0
281+ queryDuration = nil
282+ selectedLogEntry = nil
283+ errorMessage = nil
284+ resultsTruncated = false
285+ }
286+
277287 func setDefaultQuery(stream: String, previousStream: String? = nil) {
278288 // Replace the query if it's empty or still matches the auto-generated
279289 // default for the previous stream. If the user edited the SQL, keep it.
ParseableViewer/Views/LiveTailView.swift+1
@@ -173,6 +173,7 @@ struct LiveTailView: View {
173173 if viewModel.isRunning {
174174 viewModel.stop()
175175 }
176+ viewModel.clear()
176177 }
177178 }
178179}
ParseableViewer/Views/QueryView.swift+1
@@ -195,6 +195,7 @@ struct QueryView: View {
195195 }
196196 }
197197 .onChange(of: appState.selectedStream) { oldValue, newValue in
198+ viewModel.clearResults()
198199 if let stream = newValue {
199200 viewModel.setDefaultQuery(stream: stream, previousStream: oldValue)
200201 }