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

Desktop: Fixes #3748: Fixed issue when switching from search to "All notes"

This commit is contained in:
Laurent Cozic 2020-09-21 17:50:59 +01:00
parent 27c572b2f5
commit f652011d59
2 changed files with 16 additions and 12 deletions

View File

@ -1,7 +1,5 @@
import { CommandRuntime, CommandDeclaration } from '../../../lib/services/CommandService';
const Note = require('lib/models/Note');
const BaseModel = require('lib/BaseModel');
// const { _ } = require('lib/locale');
const { uuid } = require('lib/uuid.js');
export const declaration:CommandDeclaration = {
@ -31,14 +29,18 @@ export const runtime = (comp:any):CommandRuntime => {
id: comp.searchId_,
});
} else {
const note = await Note.load(comp.props.selectedNoteId);
if (note) {
comp.props.dispatch({
type: 'FOLDER_AND_NOTE_SELECT',
folderId: note.parent_id,
noteId: note.id,
});
}
// Note: Normally there's no need to do anything when the search query
// is cleared as the reducer should handle all state changes.
// https://github.com/laurent22/joplin/issues/3748
// const note = await Note.load(comp.props.selectedNoteId);
// if (note) {
// comp.props.dispatch({
// type: 'FOLDER_AND_NOTE_SELECT',
// folderId: note.parent_id,
// noteId: note.id,
// });
// }
}
},
};

View File

@ -313,7 +313,9 @@ function updateSelectedNotesFromExistingNotes(state) {
function defaultNotesParentType(state, exclusion) {
let newNotesParentType = null;
if (exclusion !== 'Folder' && state.selectedFolderId) {
if (exclusion !== 'SmartFilter' && state.selectedSmartFilterId) {
newNotesParentType = 'SmartFilter';
} else if (exclusion !== 'Folder' && state.selectedFolderId) {
newNotesParentType = 'Folder';
} else if (exclusion !== 'Tag' && state.selectedTagId) {
newNotesParentType = 'Tag';
@ -543,7 +545,7 @@ function handleHistory(state, action) {
}
const reducer = (state = defaultState, action) => {
// if (!['SIDE_MENU_OPEN_PERCENT'].includes(action.type)) console.info('Action', action.type);
// if (!['SIDE_MENU_OPEN_PERCENT'].includes(action.type)) console.info('Action', action.type, action);
let newState = state;