mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-20 02:08:57 +00:00
Improve left pane search bar behavior
This commit is contained in:
@@ -147,10 +147,8 @@ export function LeftPaneSearchInput({
|
||||
changeValue(event.currentTarget.value);
|
||||
}}
|
||||
onClear={() => {
|
||||
if (searchTerm) {
|
||||
if (searchTerm || searchConversation) {
|
||||
clearSearchQuery();
|
||||
inputRef.current?.focus();
|
||||
} else if (searchConversation) {
|
||||
endConversationSearch();
|
||||
inputRef.current?.focus();
|
||||
} else {
|
||||
|
||||
@@ -227,10 +227,22 @@ function endSearch(): EndSearchActionType {
|
||||
payload: null,
|
||||
};
|
||||
}
|
||||
function endConversationSearch(): EndConversationSearchActionType {
|
||||
return {
|
||||
type: 'END_CONVERSATION_SEARCH',
|
||||
payload: null,
|
||||
function endConversationSearch(): ThunkAction<
|
||||
void,
|
||||
RootStateType,
|
||||
unknown,
|
||||
EndConversationSearchActionType
|
||||
> {
|
||||
return async (dispatch, getState) => {
|
||||
dispatch({
|
||||
type: 'END_CONVERSATION_SEARCH',
|
||||
payload: null,
|
||||
});
|
||||
|
||||
doSearch({
|
||||
dispatch,
|
||||
state: getState(),
|
||||
});
|
||||
};
|
||||
}
|
||||
function searchInConversation(
|
||||
@@ -791,8 +803,9 @@ export function reducer(
|
||||
|
||||
if (action.type === 'END_CONVERSATION_SEARCH') {
|
||||
return {
|
||||
...getEmptyState(),
|
||||
...state,
|
||||
startSearchCounter: state.startSearchCounter + 1,
|
||||
searchConversationId: undefined,
|
||||
globalSearch: true,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user