mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Desktop: Fix issue where search bar can randomly lose focus while searching
This commit is contained in:
parent
538a1413d9
commit
489d6778db
@ -294,7 +294,7 @@ const NoteListComponent = (props: Props) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (previousSelectedNoteIds !== props.selectedNoteIds && props.selectedNoteIds.length === 1) {
|
if (previousSelectedNoteIds !== props.selectedNoteIds && props.selectedNoteIds.length === 1) {
|
||||||
const id = props.selectedNoteIds[0];
|
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++) {
|
for (let i = 0; i < props.notes.length; i++) {
|
||||||
if (props.notes[i].id === id) {
|
if (props.notes[i].id === id) {
|
||||||
@ -311,8 +311,7 @@ const NoteListComponent = (props: Props) => {
|
|||||||
if (previousVisible !== props.visible) {
|
if (previousVisible !== props.visible) {
|
||||||
updateSizeState();
|
updateSizeState();
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied
|
}, [previousSelectedNoteIds, previousNotes, previousVisible, props.selectedNoteIds, props.notes, props.focusedField, props.visible]);
|
||||||
}, [previousSelectedNoteIds, previousNotes, previousVisible, props.selectedNoteIds, props.notes]);
|
|
||||||
|
|
||||||
const scrollNoteIndex_ = (keyCode: any, ctrlKey: any, metaKey: any, noteIndex: any) => {
|
const scrollNoteIndex_ = (keyCode: any, ctrlKey: any, metaKey: any, noteIndex: any) => {
|
||||||
|
|
||||||
@ -559,6 +558,7 @@ const mapStateToProps = (state: AppState) => {
|
|||||||
highlightedWords: state.highlightedWords,
|
highlightedWords: state.highlightedWords,
|
||||||
plugins: state.pluginService.plugins,
|
plugins: state.pluginService.plugins,
|
||||||
customCss: state.customCss,
|
customCss: state.customCss,
|
||||||
|
focusedField: state.focusedField,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,4 +23,5 @@ export interface Props {
|
|||||||
highlightedWords: string[];
|
highlightedWords: string[];
|
||||||
provisionalNoteIds: string[];
|
provisionalNoteIds: string[];
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
|
focusedField: string;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user