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);
|
changeValue(event.currentTarget.value);
|
||||||
}}
|
}}
|
||||||
onClear={() => {
|
onClear={() => {
|
||||||
if (searchTerm) {
|
if (searchTerm || searchConversation) {
|
||||||
clearSearchQuery();
|
clearSearchQuery();
|
||||||
inputRef.current?.focus();
|
|
||||||
} else if (searchConversation) {
|
|
||||||
endConversationSearch();
|
endConversationSearch();
|
||||||
inputRef.current?.focus();
|
inputRef.current?.focus();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -227,10 +227,22 @@ function endSearch(): EndSearchActionType {
|
|||||||
payload: null,
|
payload: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function endConversationSearch(): EndConversationSearchActionType {
|
function endConversationSearch(): ThunkAction<
|
||||||
return {
|
void,
|
||||||
type: 'END_CONVERSATION_SEARCH',
|
RootStateType,
|
||||||
payload: null,
|
unknown,
|
||||||
|
EndConversationSearchActionType
|
||||||
|
> {
|
||||||
|
return async (dispatch, getState) => {
|
||||||
|
dispatch({
|
||||||
|
type: 'END_CONVERSATION_SEARCH',
|
||||||
|
payload: null,
|
||||||
|
});
|
||||||
|
|
||||||
|
doSearch({
|
||||||
|
dispatch,
|
||||||
|
state: getState(),
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function searchInConversation(
|
function searchInConversation(
|
||||||
@@ -791,8 +803,9 @@ export function reducer(
|
|||||||
|
|
||||||
if (action.type === 'END_CONVERSATION_SEARCH') {
|
if (action.type === 'END_CONVERSATION_SEARCH') {
|
||||||
return {
|
return {
|
||||||
...getEmptyState(),
|
...state,
|
||||||
startSearchCounter: state.startSearchCounter + 1,
|
startSearchCounter: state.startSearchCounter + 1,
|
||||||
|
searchConversationId: undefined,
|
||||||
globalSearch: true,
|
globalSearch: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user