From 0322e78e8a5e79100bc19bb1862bd3b53753e9bb Mon Sep 17 00:00:00 2001 From: Lawrence Chen Date: Mon, 30 Mar 2026 18:50:10 -0700 Subject: [PATCH] Stop stale command palette empty-state flashes --- Sources/ContentView.swift | 1 - cmuxTests/CommandPaletteSearchEngineTests.swift | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Sources/ContentView.swift b/Sources/ContentView.swift index 8145ea58..5f349123 100644 --- a/Sources/ContentView.swift +++ b/Sources/ContentView.swift @@ -4539,7 +4539,6 @@ struct ContentView: View { } return currentMatchingQuery == resolvedMatchingQuery - || currentMatchingQuery.hasPrefix(resolvedMatchingQuery) } private func scheduleCommandPaletteResultsRefresh( diff --git a/cmuxTests/CommandPaletteSearchEngineTests.swift b/cmuxTests/CommandPaletteSearchEngineTests.swift index 128ecc01..eac9916e 100644 --- a/cmuxTests/CommandPaletteSearchEngineTests.swift +++ b/cmuxTests/CommandPaletteSearchEngineTests.swift @@ -499,6 +499,20 @@ final class CommandPaletteSearchEngineTests: XCTestCase { ) } + func testPendingEmptyStateIsPreservedForSameResolvedNoMatchQuery() { + XCTAssertTrue( + ContentView.commandPaletteShouldPreserveEmptyStateWhileSearchPending( + isSearchPending: true, + visibleResultsScopeMatches: true, + resolvedSearchScopeMatches: true, + resolvedSearchFingerprintMatches: true, + resolvedResultsAreEmpty: true, + currentMatchingQuery: "zzzzzzzz", + resolvedMatchingQuery: "zzzzzzzz" + ) + ) + } + func testPendingEmptyStateIsNotPreservedWhenQueryDoesNotRefineResolvedNoMatch() { XCTAssertFalse( ContentView.commandPaletteShouldPreserveEmptyStateWhileSearchPending(