Skip to content

Search shows "No Results" while a query is still debouncing/loading #22

Description

@NickReisenauer

Spotted during a UI review of the recent media-view changes. Files: simalytics/Views/Explore/SearchResultsView.swift (the if visibleResults.isEmpty branch) + SearchResultsViewModel.

SearchResultsView mounts as soon as searchText is non-empty, and searchResults starts [], so the very first keystroke immediately shows ContentUnavailableView("No Results"). debounceSearch then sleeps ~1s and (for the .all scope) runs three sequential network fetches, so the misleading "No Results" screen is shown for 1s+ (often several seconds) on every keystroke before real results arrive. It reads as "your query matched nothing" when in fact nothing has been searched yet.

Fix: track an in-flight / has-searched state. e.g. @State private var isSearching = false; set it true in the .onChange handlers right before calling debounceSearch, and false when results are assigned. Then show the empty state only when visibleResults.isEmpty && !isSearching, and show a ProgressView (or nothing) while isSearching && visibleResults.isEmpty. Optionally clear stale results when the query changes so previous matches don't linger.

Source: multi-agent UI review, 2026-07-02.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions