1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-27 08:21:03 +02:00

Desktop: Fix issue where search bar can randomly lose focus while searching

This commit is contained in:
Laurent Cozic 2023-03-13 12:18:06 +00:00
parent c96468149a
commit bd4291462e
2 changed files with 4 additions and 3 deletions

View File

@ -294,7 +294,7 @@ const NoteListComponent = (props: Props) => {
useEffect(() => {
if (previousSelectedNoteIds !== props.selectedNoteIds && props.selectedNoteIds.length === 1) {
const id = props.selectedNoteIds[0];
const doRefocus = props.notes.length < previousNotes.length;
const doRefocus = props.notes.length < previousNotes.length && !props.focusedField;
for (let i = 0; i < props.notes.length; i++) {
if (props.notes[i].id === id) {
@ -311,8 +311,7 @@ const NoteListComponent = (props: Props) => {
if (previousVisible !== props.visible) {
updateSizeState();
}
// eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied
}, [previousSelectedNoteIds, previousNotes, previousVisible, props.selectedNoteIds, props.notes]);
}, [previousSelectedNoteIds, previousNotes, previousVisible, props.selectedNoteIds, props.notes, props.focusedField, props.visible]);
const scrollNoteIndex_ = (keyCode: any, ctrlKey: any, metaKey: any, noteIndex: any) => {
@ -559,6 +558,7 @@ const mapStateToProps = (state: AppState) => {
highlightedWords: state.highlightedWords,
plugins: state.pluginService.plugins,
customCss: state.customCss,
focusedField: state.focusedField,
};
};

View File

@ -23,4 +23,5 @@ export interface Props {
highlightedWords: string[];
provisionalNoteIds: string[];
visible: boolean;
focusedField: string;
}