1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

Desktop: Fixes #10586: Don't re-order the note list when in search (#10587)

This commit is contained in:
Henry Heino 2024-06-14 11:39:26 -07:00 committed by GitHub
parent bf634270be
commit 8cf4ef88b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,11 +11,14 @@ import { FolderEntity, NoteEntity } from './services/database/types';
import { getListRendererIds } from './services/noteList/renderers';
import { ProcessResultsRow } from './services/search/SearchEngine';
import { getDisplayParentId } from './services/trash';
import Logger from '@joplin/utils/Logger';
const fastDeepEqual = require('fast-deep-equal');
const { ALL_NOTES_FILTER_ID } = require('./reserved-ids');
const { createSelectorCreator, defaultMemoize } = require('reselect');
const { createCachedSelector } = require('re-reselect');
const logger = Logger.create('lib/reducer');
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
const additionalReducers: any[] = [];
@ -1045,7 +1048,11 @@ const reducer = produce((draft: Draft<State> = defaultState, action: any) => {
case 'NOTE_SORT':
{
draft.notes = Note.sortNotes(draft.notes, stateUtils.notesOrder(draft.settings), draft.settings.uncompletedTodosOnTop);
if (draft.notesParentType === 'Search') {
logger.debug('Not sorting the note list -- sorting should be done by search.');
} else {
draft.notes = Note.sortNotes(draft.notes, stateUtils.notesOrder(draft.settings), draft.settings.uncompletedTodosOnTop);
}
draft.noteListLastSortTime = Date.now();
}
break;