@@ -132,8 +132,15 @@ class FileBrowserViewModel(private val container: AppContainer) : ViewModel() {
132 openJob?.cancel()
132 openJob?.cancel()
133 if (query.isBlank()) {
133 if (query.isBlank()) {
134 _state.update { it.copy(results = emptyList(), searching = false) }
134 _state.update { it.copy(results = emptyList(), searching = false) }
135+ // Cancelling openJob above may have interrupted an in-flight directory load,
136+ // leaving loading=true stuck. Re-open the current directory so the listing
137+ // re-populates instead of showing a perpetual spinner after clearing search.
138+ open(_state.value.path)
141+ // The search view replaces the directory listing; clear loading so the spinner
142+ // from a cancelled open() doesn't persist into the search results view.
143+ _state.update { it.copy(loading = false) }
137 val client = api ?: run {
144 val client = api ?: run {
138 _state.update { it.copy(searching = false, error = container.string(R.string.not_connected)) }
145 _state.update { it.copy(searching = false, error = container.string(R.string.not_connected)) }