git.iko.soy/parseable-macos
on master help sign in
Fix query text not clearing when switching streams after opening saved filter (#46)
commitd1db137d7f4cbeb2c1bd690bfb99685141e6a627 authoriko <mail@iko.soy> dateMon 16 Feb 2026, 02:42 (8 months ago) parentf7b34e9
1 file changed+4−6
ParseableViewer/ViewModels/QueryViewModel.swift+4−6
ParseableViewer/ViewModels/QueryViewModel.swift+4−6
@@ -536,14 +536,12 @@ final class QueryViewModel {
536536 /// query text was replaced (i.e. the user hadn't customized it).
537537 @discardableResult
538538 func setDefaultQuery(stream: String, previousStream: String? = nil) -> Bool {
539− // Replace the query if it's empty or still matches the auto-generated
540− // default for the previous stream. If the user edited the SQL, keep it.
539+ // Always replace when switching streams — the previous query (whether
540+ // auto-generated or from a saved filter) belongs to the old stream.
541+ // Only preserve the query when no stream change occurred (e.g. onAppear).
541542 let shouldReplace: Bool
542− if sqlQuery.isEmpty {
543+ if sqlQuery.isEmpty || previousStream != nil {
543544 shouldReplace = true
544− } else if let prev = previousStream {
545− let prevPrefix = "SELECT * FROM \(Self.escapeSQLIdentifier(prev))"
546− shouldReplace = sqlQuery.hasPrefix(prevPrefix)
547545 } else {
548546 shouldReplace = false
549547 }