Fix lost focus when typing in archived message while searching
This commit is contained in:
parent
089116d069
commit
e79fb9d2e5
4 changed files with 17 additions and 12 deletions
|
@ -423,6 +423,7 @@ story.add('Archive: no archived conversations', () => (
|
|||
archivedConversations: [],
|
||||
searchConversation: undefined,
|
||||
searchTerm: '',
|
||||
startSearchCounter: 0,
|
||||
},
|
||||
})}
|
||||
/>
|
||||
|
@ -436,6 +437,7 @@ story.add('Archive: archived conversations', () => (
|
|||
archivedConversations: defaultConversations,
|
||||
searchConversation: undefined,
|
||||
searchTerm: '',
|
||||
startSearchCounter: 0,
|
||||
},
|
||||
})}
|
||||
/>
|
||||
|
@ -449,6 +451,7 @@ story.add('Archive: searching a conversation', () => (
|
|||
archivedConversations: defaultConversations,
|
||||
searchConversation: undefined,
|
||||
searchTerm: '',
|
||||
startSearchCounter: 0,
|
||||
},
|
||||
})}
|
||||
/>
|
||||
|
|
|
@ -13,7 +13,7 @@ import { RowType } from '../ConversationList';
|
|||
import type { PropsData as ConversationListItemPropsType } from '../conversationList/ConversationListItem';
|
||||
import type { LocalizerType } from '../../types/Util';
|
||||
import type { ConversationType } from '../../state/ducks/conversations';
|
||||
import { LeftPaneSearchInput } from '../LeftPaneSearchInput';
|
||||
import { LeftPaneMainSearchInput } from '../LeftPaneMainSearchInput';
|
||||
import type { LeftPaneSearchPropsType } from './LeftPaneSearchHelper';
|
||||
import { LeftPaneSearchHelper } from './LeftPaneSearchHelper';
|
||||
|
||||
|
@ -21,6 +21,7 @@ type LeftPaneArchiveBasePropsType = {
|
|||
archivedConversations: ReadonlyArray<ConversationListItemPropsType>;
|
||||
searchConversation: undefined | ConversationType;
|
||||
searchTerm: string;
|
||||
startSearchCounter: number;
|
||||
};
|
||||
|
||||
export type LeftPaneArchivePropsType =
|
||||
|
@ -36,12 +37,15 @@ export class LeftPaneArchiveHelper extends LeftPaneHelper<LeftPaneArchivePropsTy
|
|||
|
||||
private readonly searchHelper: undefined | LeftPaneSearchHelper;
|
||||
|
||||
private readonly startSearchCounter: number;
|
||||
|
||||
constructor(props: Readonly<LeftPaneArchivePropsType>) {
|
||||
super();
|
||||
|
||||
this.archivedConversations = props.archivedConversations;
|
||||
this.searchConversation = props.searchConversation;
|
||||
this.searchTerm = props.searchTerm;
|
||||
this.startSearchCounter = props.startSearchCounter;
|
||||
|
||||
if ('conversationResults' in props) {
|
||||
this.searchHelper = new LeftPaneSearchHelper(props);
|
||||
|
@ -72,6 +76,7 @@ export class LeftPaneArchiveHelper extends LeftPaneHelper<LeftPaneArchivePropsTy
|
|||
}
|
||||
|
||||
override getSearchInput({
|
||||
clearConversationSearch,
|
||||
clearSearch,
|
||||
i18n,
|
||||
updateSearchTerm,
|
||||
|
@ -86,19 +91,14 @@ export class LeftPaneArchiveHelper extends LeftPaneHelper<LeftPaneArchivePropsTy
|
|||
}
|
||||
|
||||
return (
|
||||
<LeftPaneSearchInput
|
||||
<LeftPaneMainSearchInput
|
||||
clearConversationSearch={clearConversationSearch}
|
||||
clearSearch={clearSearch}
|
||||
i18n={i18n}
|
||||
onChangeValue={newValue => {
|
||||
updateSearchTerm(newValue);
|
||||
}}
|
||||
onClear={() => {
|
||||
clearSearch();
|
||||
}}
|
||||
ref={el => {
|
||||
el?.focus();
|
||||
}}
|
||||
searchConversation={this.searchConversation}
|
||||
value={this.searchTerm}
|
||||
searchTerm={this.searchTerm}
|
||||
startSearchCounter={this.startSearchCounter}
|
||||
updateSearchTerm={updateSearchTerm}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -107,6 +107,7 @@ const getModeSpecificProps = (
|
|||
archivedConversations,
|
||||
searchConversation,
|
||||
searchTerm,
|
||||
startSearchCounter: getStartSearchCounter(state),
|
||||
...(searchConversation && searchTerm ? getSearchResults(state) : {}),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ describe('LeftPaneArchiveHelper', () => {
|
|||
archivedConversations: [],
|
||||
searchConversation: undefined,
|
||||
searchTerm: '',
|
||||
startSearchCounter: 0,
|
||||
};
|
||||
|
||||
const searchingDefaults = {
|
||||
|
|
Loading…
Add table
Reference in a new issue