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