You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-08-13 22:12:50 +02:00
Desktop: Fixes #3481: Crash when applying tags to multiple notes from within another tag
This commit is contained in:
@@ -295,6 +295,21 @@ function updateOneItem(state, action, keyName = '') {
|
|||||||
return newState;
|
return newState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateSelectedNotesFromExistingNotes(state) {
|
||||||
|
const newSelectedNoteIds = [];
|
||||||
|
for (const selectedNoteId of state.selectedNoteIds) {
|
||||||
|
for (const n of state.notes) {
|
||||||
|
if (n.id === selectedNoteId) {
|
||||||
|
newSelectedNoteIds.push(n.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Object.assign({}, state, {
|
||||||
|
selectedNoteIds: newSelectedNoteIds,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function defaultNotesParentType(state, exclusion) {
|
function defaultNotesParentType(state, exclusion) {
|
||||||
let newNotesParentType = null;
|
let newNotesParentType = null;
|
||||||
|
|
||||||
@@ -637,12 +652,12 @@ const reducer = (state = defaultState, action) => {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
// Replace all the notes with the provided array
|
// Replace all the notes with the provided array
|
||||||
case 'NOTE_UPDATE_ALL':
|
case 'NOTE_UPDATE_ALL':
|
||||||
newState = Object.assign({}, state);
|
newState = Object.assign({}, state);
|
||||||
newState.notes = action.notes;
|
newState.notes = action.notes;
|
||||||
newState.notesSource = action.notesSource;
|
newState.notesSource = action.notesSource;
|
||||||
|
newState = updateSelectedNotesFromExistingNotes(newState);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Insert the note into the note list if it's new, or
|
// Insert the note into the note list if it's new, or
|
||||||
@@ -707,7 +722,6 @@ const reducer = (state = defaultState, action) => {
|
|||||||
newState.selectedNoteIds = newIndex >= 0 ? [newNotes[newIndex].id] : [];
|
newState.selectedNoteIds = newIndex >= 0 ? [newNotes[newIndex].id] : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (action.provisional) {
|
if (action.provisional) {
|
||||||
newState.provisionalNoteIds.push(modNote.id);
|
newState.provisionalNoteIds.push(modNote.id);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user