fix(communication): set searchLoading=true in setSearchQuery
setSearchQuery only incremented searchRequestId without flipping searchLoading, so the UI could not distinguish "searching" from "no results". Now loading flips true on non-empty query and clears (results + loading) on empty query. setSearchResults keeps the existing id-match logic to flip loading false on arrival.
This commit is contained in:
1 parent
aa1afd0db2
commit
a612ea7bea
1 file changed
+6
@@ -33,6 +33,12 @@ export const createCommunicationSlice: StateCreator<
|
||||
set((state) => {
|
||||
state.searchQuery = query;
|
||||
state.searchRequestId += 1;
|
||||
if (query === "") {
|
||||
state.searchLoading = false;
|
||||
state.searchResults = [];
|
||||
} else {
|
||||
state.searchLoading = true;
|
||||
}
|
||||
}),
|
||||
setSearchScope: (scope) =>
|
||||
set((state) => {
|
||||
|
||||
Reference in new issue
Block a user